0. Base64 decode the encrypted message
 1. Split the string in to the AES key and the encrypted message
 2. Decrypt the AES key using the private key
 3. Decrypt the message using the AES key
352681
def decrypt(message, hash: nil)
      # 0
      message = Base64.decode64(message)
      hmac = message[0..63] # 64 bits of hmac signature

      case
      when hash && hmac != hash
        raise Error, "Provided hash mismatch for encrypted file!"
      when hmac != hmac_signature(message[64..-1])
        raise Error, "HMAC signature mismatch for encrypted file!"
      end

      # 1
      rsa_encrypted_aes_key = message[64..319]  # next 256 bits
      rsa_encrypted_aes_iv  = message[320..575] # next 256 bits
      aes_encrypted_message = message[576..-1]

      # 2
      aes_key = @rsa.private_decrypt rsa_encrypted_aes_key
      aes_iv  = @rsa.private_decrypt rsa_encrypted_aes_iv

      # 3
      @cipher.reset
      @cipher.decrypt
      @cipher.key = aes_key
      @cipher.iv  = aes_iv
      content = @cipher.update(aes_encrypted_message) + @cipher.final

      { signature: hmac, content: content }
    rescue OpenSSL::OpenSSLError => e
      raise Error.new(e.message)
    end
762825
def decode_auth_plain(ciphertext)
      message = begin
                  @ecc.ecies_decrypt ciphertext[0,307]
                rescue
                  raise AuthenticationError, $!
                end
      raise RLPxSessionError, 'invalid message length' unless message.size == 194

      sig = message[0,65]
      pubkey = message[65+32,64]
      raise InvalidKeyError, 'invalid initiator pubkey' unless Crypto::ECCx.valid_key?(pubkey)

      nonce = message[65+32+64,32]
      flag = message[(65+32+64+32)..-1].ord
      raise RLPxSessionError, 'invalid flag' unless flag == 0

      [307, sig, pubkey, nonce, 4]
    end
328834
function decrypt(key, iv, data) {
    if(!Buffer.isBuffer(key)) {
        assert(typeof key === 'string');
        key = Buffer.from(key, 'binary')
    }

    if(!Buffer.isBuffer(iv)) {
        assert(typeof iv === 'string');
        iv = Buffer.from(iv, 'binary')
    }

    if(!Buffer.isBuffer(data)) {
        assert(typeof data === 'string');
        data = Buffer.from(data, 'binary')
    }

    let ret = Buffer.alloc(data.length/2);
    for(let i = 0; i < ret.length; i++){
        ret[i] = ((data[i*2]-97)<<4) | (data[i*2+1]-97);
    }

    var decoded = aes.decipher(ret, key, iv);
    return decoded.toString('binary');
}
707325
private byte[] maybeDecodeBase64(byte[] byteArray) {
    try {
      String pem = new String(byteArray);
      // Remove required begin/end lines.
      pem = pem.substring(BEGIN_CERT_LINE_LENGTH, pem.length() - END_CERT_LINE_LENGTH);
      return Base64.getDecoder().decode(pem);
    } catch (Exception e) {
      // Not a valid PEM encoded certificate, return original array.
      return byteArray;
    }
  }
1122061
def decryptstring(enc, password):
    

    dec = []
    enc = base64.urlsafe_b64decode(enc).decode()
    for i in enumerate(enc):
        key_c = password[i[0] % len(password)]
        dec_c = chr((256 + ord(i[1]) - ord(key_c)) % 256)
        dec.append(dec_c)
    return "".join(dec)
480515
public String encrypt(String message) throws GeneralSecurityException {
		byte[] bytes = encryptor.encrypt(message.getBytes());
		return Base64.getEncoder().encodeToString(bytes);
	}
1299216
def old_decode_aes(key, iv_plus_encrypted):
    
    # grab first 16 bytes (aka 32 characters of hex) - that's the IV
    hexed_iv = iv_plus_encrypted[:32]
    # grab everything else - that's the ciphertext (aka encrypted message)
    hexed_ciphertext = iv_plus_encrypted[32:]
    # unhex the iv and ciphertext
    iv = binascii.unhexlify(hexed_iv)
    ciphertext = binascii.unhexlify(hexed_ciphertext)
    # set up the correct AES cipher object
    cipher = AES.new(ensure_bytes(old_pad(key)), mode=AES.MODE_CBC, IV=iv)
    # decrypt!
    plaintext = cipher.decrypt(ciphertext)
    # return the unpadded version of this
    return old_unpad(plaintext)
1181913
def rsa_base64_decrypt(self, cipher, b64=True):
        
        with open(self.key_file) as fp:
            key_ = RSA.importKey(fp.read())
            _cip = PKCS1_v1_5.new(key_)
            cipher = base64.b64decode(cipher) if b64 else cipher
            plain = _cip.decrypt(cipher, Random.new().read(15 + SHA.digest_size))
            return helper.to_str(plain)
1332533
public String decrypt(String encrypted) throws Exception {

        byte[] decodedValue = Base64Coder.decode(encrypted.toCharArray());

        Cipher c = getCipher(Cipher.DECRYPT_MODE);
        byte[] decValue = c.doFinal(decodedValue);

        return new String(decValue);
    }
210697
public static String decrypt(String keyBase64, String encrypted) {
        return decrypt(Base64.decodeBase64(keyBase64.getBytes(StandardCharsets.UTF_8)), encrypted);
    }
981698
def decode_aes256_plain_auto(data, encryption_key):
    """"""
    assert isinstance(data, bytes)
    length = len(data)

    if length == 0:
        return b''
    elif data[0] == b'!'[0] and length % 16 == 1 and length > 32:
        return decode_aes256_cbc_plain(data, encryption_key)
    else:
        return decode_aes256_ecb_plain(data, encryption_key)
405320
def encrypt(password)
      encoded_password = Base64.strict_encode64 "#{password}|#{time_stamp}"

      encrypted_password = public_key.public_encrypt encoded_password

      Base64.strict_encode64 encrypted_password
    end
1108405
function encode(password, cb) {
  var secret_key = conf.secret_key
    , iterations = conf.pbkdf2_iterations
    , keylen = conf.pbkdf2_keylen;

  crypto.pbkdf2(password, secret_key, iterations, keylen, function(err, derivedKey) {
    var str;

    if(err) {
      cb(err);
    } else {
      str = new Buffer(derivedKey).toString('base64');
      cb(null, str);
    }
  });
}
344303
public static String decrypt(String base64Cipher, String priKey) {
        return new String(RSA.decrypt(Base64Util.decode(base64Cipher), decryptPrivateKey(priKey)));
    }
1229715
def decode_bytes(string):
    

    if is_string_type(type(string)):
        string = bytes(string, "utf-8")
    return base64.decodebytes(string)
770612
def decrypt(self, ciphertext):
        """"""

        # String to bytes.
        cipherbytes = ciphertext.encode('utf8')

        # Decode from Base64.
        try:
            combined = base64.b64decode(cipherbytes)
        except (base64.binascii.Error, TypeError) as e:
            # base64.binascii.Error for Python 3.
            # TypeError for Python 2.
            raise DataIntegrityError("Cipher text is damaged: {}".format(e))

        # Split out the nonce, tag, and encrypted data.
        nonce = combined[:12]
        if len(nonce) != 12:
            raise DataIntegrityError("Cipher text is damaged: invalid nonce length")

        tag = combined[12:28]
        if len(tag) != 16:
            raise DataIntegrityError("Cipher text is damaged: invalid tag length")

        encrypted = combined[28:]

        # Construct AES cipher, with old nonce.
        cipher = AES.new(self.cipher_key, AES.MODE_GCM, nonce)

        # Decrypt and verify.
        try:
            compressed = cipher.decrypt_and_verify(encrypted, tag)
        except ValueError as e:
            raise DataIntegrityError("Cipher text is damaged: {}".format(e))

        # Decompress plaintext bytes.
        plainbytes = zlib.decompress(compressed)

        # Bytes to string.
        plaintext = plainbytes.decode('utf8')

        # Return plaintext.
        return plaintext
343371
def decodeBase64(text, encoding='utf-8'):
    
    text = projex.text.toBytes(text, encoding)
    return projex.text.toUnicode(base64.b64decode(text), encoding)