Example return encrypted(........)

@param password String to be encrypted
@return String encrypted String
171129
public static char[] encrypt(char[] password)
	{
		if (password == null || password.length == 0)
		{
			return null;
		}

		try
		{
			String encryptedString = null;

			SecretKeySpec key = new SecretKeySpec(init, "Blowfish");
			Cipher cipher = Cipher.getInstance(CIPHER_INSTANCE);
			cipher.init(Cipher.ENCRYPT_MODE, key);
			byte[] encrypted = cipher.doFinal(String.valueOf(password).getBytes(Charset.forName("UTF8")));
			encryptedString = byteArrayToHexString(encrypted);

			return encryptedString.toCharArray();
		}
		catch (Exception e)
		{
			throw new SecurityException("Unable to encrypt password", e);
		}
	}
923283
public function encryptPassword($password, $salt = null)
    {
        if (!is_string($this->password_encryption) && is_callable($this->password_encryption)) {
            $e = $this->password_encryption;

            return $e($password, $salt);
        }
        if ($this->password_encryption) {
            $this->debug("Encrypting password: '$password' with ".$this->password_encryption.' salt='.$salt);
        }
        switch ($this->password_encryption) {
            case null:
                return $password;
            case 'php':
                // returns false on failure
                return password_hash($password, $this->hash_algo, $this->hash_options);
            case 'sha256/salt':
                if ($salt === null) {
                    throw $this->exception(
                        'sha256 requires salt (2nd argument to encryptPassword and is normaly an email)'
                    );
                }
                $key = $this->app->getConfig('auth/key', $this->app->name);
                if ($this->password_encryption) {
                    $this->debug('Using key '.$key);
                }

                return hash_hmac('sha256', $password.$salt, $key);
            case 'sha1':
                return sha1($password);
            case 'md5':
                return md5($password);
            case 'rot13':
                return str_rot13($password);
            default:
                throw $this->exception('No such encryption method')
                    ->addMoreInfo('encryption', $this->password_encryption);
        }
    }
1320368
def encryptstring(text, password):
    

    enc = []
    for i in enumerate(text):
        key_c = password[i[0] % len(password)]
        enc_c = chr((ord(i[1]) + ord(key_c)) % 256)
        enc.append(enc_c)
    return base64.urlsafe_b64encode("".join(enc).encode()).decode()
967681
public void encrypt(byte[] password) throws GeneralSecurityException {

        if (isEncrypted()) {
            return;
        }

        if (this.encAlg == null) {
            setEncryptionAlgorithm("DES-EDE3-CBC");
        }

        if (this.ivData == null) {
            generateIV();
        }

        Key key = getSecretKey(password, this.initializationVector.getIV());

        Cipher cipher = getCipher();
        cipher.init(Cipher.ENCRYPT_MODE, key, this.initializationVector);

        /* encrypt the raw PKCS11 */

        this.keyData = cipher.doFinal(getEncoded(this.intKey));
        this.isEncrypted = true;
        this.encodedKey = null;
    }
135526
public String enpass(String password) throws IOException {
	  ByteArrayOutputStream baos = new ByteArrayOutputStream();
	  enpass(password,baos);
	  return new String(baos.toByteArray());
  }
378209
public String decryptPassword(String encrypted) {
    Preconditions.checkArgument(this.encryptors.size() > 0,
        "A master password needs to be provided for decrypting passwords.");

    for (TextEncryptor encryptor : encryptors) {
      try {
        return encryptor.decrypt(encrypted);
      } catch (Exception e) {
        LOG.warn("Failed attempt to decrypt secret {}", encrypted, e);
      }
    }
    LOG.error("All {} decrypt attempt(s) failed.", encryptors.size());
    throw new RuntimeException("Failed to decrypt password ENC(" + encrypted + ")");
  }
1261457
public static String encrypt(String password, String salt) {
        String saltPassword = password + salt;
        return DigestUtils.sha256Hex(saltPassword.getBytes());
    }
1065695
public boolean isPasswordCorrect(String password) {
		final String actualPassword = configurationRegistry.getString(updateConfigPasswordKey);
		return "".equals(actualPassword) || actualPassword != null && actualPassword.equals(password);
	}
665276
public String encryptString(String credentials) {
        byte[] credentialBytes = checkNotNull(credentials, "credentials").getBytes(Charsets.UTF_8);
        return encryptBytes(credentialBytes);
    }
922829
public static String decodePasswordWithPrefix(final String encodedPasswordWithPrefix) {
        if (encodedPasswordWithPrefix == null) {
            return null;
        }
        if (hasPrefix(encodedPasswordWithPrefix)) {
            return decodePassword(encodedPasswordWithPrefix.substring(PREFIX.length()));
        } else {
            return encodedPasswordWithPrefix;
        }
    }
59650
public final String encodeKeyStore(KeyStore keyStore, char[] password) {
        logger.entry();
        try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
            keyStore.store(out, password);
            out.flush();
            byte[] bytes = out.toByteArray();
            String encodedKeyStore = Base64Utils.encode(bytes);
            logger.exit();
            return encodedKeyStore;
        } catch (IOException | KeyStoreException | NoSuchAlgorithmException | CertificateException e) {
            RuntimeException exception = new RuntimeException("An unexpected exception occurred while attempting to encode a keystore.", e);
            logger.error(exception.toString());
            throw exception;
        }
    }
143849
def _encrypt_password(self, password):
        
        if self.encryption_mode.lower() == 'crypt':
            return self._crypt_password(password)
        elif self.encryption_mode.lower() == 'md5':
            return self._md5_password(password)
        elif self.encryption_mode.lower() == 'md5-base':
            return self._md5_base_password(password)
        else:
            raise UnknownEncryptionMode(self.encryption_mode)
1332001
function encode_password($password){
        $password="\"".$password."\"";
        $encoded="";
        for ($i=0; $i <strlen($password); $i++){ $encoded.="{$password{$i}}\000"; }
        return ($encoded);
    }
1013552
public String depass(String password) throws IOException {
	  if(password==null)return null;
	  ByteArrayOutputStream baos = new ByteArrayOutputStream();
	  depass(password,baos);
	  return new String(baos.toByteArray());
  }
181011
public static function hashPassword($password)
    {
        # Test the message and key for string validity.
        Helpers::isString($password, 'Hash', 'hashPassword');

        return \Sodium\crypto_pwhash_scryptsalsa208sha256_str(
            $password,
            Constants::PWHASH_SCRYPTSALSA208SHA256_OPSLIMIT_INTERACTIVE,
            Constants::PWHASH_SCRYPTSALSA208SHA256_MEMLIMIT_INTERACTIVE
        );
    }
1173867
def encrypt(self, password):
        
        if not password or not self._crypter:
            return password or b''
        return self._crypter.encrypt(password)
1286647
@Override
    public String encryptPassword(String cleartext) {
        String encrypted = sha256Encryptor.encryptPassword(cleartext);
        if (encrypted.endsWith("\n")) {
            encrypted = encrypted.substring(0, encrypted.length() - 1);
        }
        encrypted = SHA256_PREFIX.concat(encrypted);
        return encrypted;
    }