Decrypt a plain text block.
169184
def decrypt(key, ct, Nk=4):
    """"""
    assert Nk in {4, 6, 8}
    rkey = key_expand(key, Nk)
    pt = inv_cipher(rkey, ct, Nk)

    return pt
623261
def decrypt(crypt_text) -> str:
        
        cipher = Fernet(current_app.config['KEY'])
        if not isinstance(crypt_text, bytes):
            crypt_text = str.encode(crypt_text)
        return cipher.decrypt(crypt_text).decode("utf-8")
1116894
def encrypt(plain)
      fail ArgumentError, 'No plain text supplied.' if plain.nil? || plain.empty?

      cipher = self.class.cipher
      cipher.encrypt
      cipher.key = Base64.decode64(@key)
      cipher.iv = iv = cipher.random_iv
      encrypted = cipher.update(plain)
      encrypted << cipher.final

      iv = Base64.strict_encode64(iv)
      encrypted = Base64.strict_encode64(encrypted)

      "$#{iv}$#{encrypted}"
    end
1034541
def decrypt(payload, private_key):
        """"""
        cipher = PKCS1_v1_5.new(private_key)
        aes_key_str = cipher.decrypt(b64decode(payload.get("aes_key")), sentinel=None)
        aes_key = json.loads(aes_key_str.decode("utf-8"))
        key = b64decode(aes_key.get("key"))
        iv = b64decode(aes_key.get("iv"))
        encrypted_magic_envelope = b64decode(payload.get("encrypted_magic_envelope"))
        encrypter = AES.new(key, AES.MODE_CBC, iv)
        content = encrypter.decrypt(encrypted_magic_envelope)
        return etree.fromstring(pkcs7_unpad(content))
989706
def dump_raw(self, text, stream=None):
        """"""
        encrypted = self.vault.encrypt(text)
        if stream:
            stream.write(encrypted)
        else:
            return encrypted
609900
def encrypt(message, modN, e, blockSize):
    """"""
    numList = string2numList(message)
    numBlocks = numList2blocks(numList, blockSize)  # only one block
    message = numBlocks[0]
    # return [modExp(blocks, e, modN) for blocks in numBlocks]
    return modExp(message, e, modN)
1354236
static byte[] decode(byte[] decrypted) {
        int pad = (int) decrypted[decrypted.length - 1];
        if (pad < 1 || pad > 32) {
            pad = 0;
        }
        return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
    }
267621
def decrypt(data, digest=True):
    """"""
    alg, _, data = data.rpartition("$")
    if not alg:
        return data
    data = _from_hex_digest(data) if digest else data
    try:
        return implementations["decryption"][alg](
            data, implementations["get_key"]()
        )
    except KeyError:
        raise CryptError("Can not decrypt key for algorithm: %s" % alg)
1301387
function decrypt(userKey, chiperText) {
        var i
          , offset
          , cpt = []
          , tmpBlockDecrypt;

        if (utils.isAnArray(userKey) &&
          utils.isAnArray(chiperText)) {

          userKey = new Uint8Array(userKey);
          chiperText = new Uint8Array(chiperText);
        } else {

          throw 'Inputs must be an array';
        }
        userKey = makeKey(userKey);

        for (offset = 0; offset < chiperText.length; offset += 16) {

          tmpBlockDecrypt = blockDecrypt(chiperText, offset, userKey);
          for (i = 0; i < tmpBlockDecrypt.length; i += 1) {

            cpt.push(tmpBlockDecrypt[i]);
          }
        }

        return cpt;
      }
1267054
def decrypt(self, ciphertext):
        ''

        if len(ciphertext) != 16:
            raise ValueError('wrong block length')

        rounds = len(self._Kd) - 1
        (s1, s2, s3) = [3, 2, 1]
        a = [0, 0, 0, 0]

        # Convert ciphertext to (ints ^ key)
        t = [(_compact_word(ciphertext[4 * i:4 * i + 4]) ^ self._Kd[0][i]) for i in xrange(0, 4)]

        # Apply round transforms
        for r in xrange(1, rounds):
            for i in xrange(0, 4):
                a[i] = (self.T5[(t[ i          ] >> 24) & 0xFF] ^
                        self.T6[(t[(i + s1) % 4] >> 16) & 0xFF] ^
                        self.T7[(t[(i + s2) % 4] >>  8) & 0xFF] ^
                        self.T8[ t[(i + s3) % 4]        & 0xFF] ^
                        self._Kd[r][i])
            t = copy.copy(a)

        # The last round is special
        result = [ ]
        for i in xrange(0, 4):
            tt = self._Kd[rounds][i]
            result.append((self.Si[(t[ i           ] >> 24) & 0xFF] ^ (tt >> 24)) & 0xFF)
            result.append((self.Si[(t[(i + s1) % 4] >> 16) & 0xFF] ^ (tt >> 16)) & 0xFF)
            result.append((self.Si[(t[(i + s2) % 4] >>  8) & 0xFF] ^ (tt >>  8)) & 0xFF)
            result.append((self.Si[ t[(i + s3) % 4]        & 0xFF] ^  tt       ) & 0xFF)

        return result
252781
function AES_Decrypt(block, key) {
	var l = key.length;
	AES_AddRoundKey(block, key.slice(l - 16, l));
	AES_ShiftRows(block, AES_ShiftRowTab_Inv);
	AES_SubBytes(block, AES_Sbox_Inv);
	for(var i = l - 32; i >= 16; i -= 16) {
		AES_AddRoundKey(block, key.slice(i, i + 16));
		AES_MixColumns_Inv(block);
		AES_ShiftRows(block, AES_ShiftRowTab_Inv);
		AES_SubBytes(block, AES_Sbox_Inv);
	}
	AES_AddRoundKey(block, key.slice(0, 16));
	return block;
}
538255
def decrypt(self, encrypted):
        
        decoded = b64decode(encrypted)
        init_vec = decoded[:AES.block_size]
        cipher = AES.new(self._key, AES.MODE_CBC, init_vec)

        return AESCipher.unpad(cipher.decrypt(decoded[AES.block_size:]))
804894
def decrypt(self, data):
        '''
        
        '''
        aes_key, hmac_key = self.keys
        sig = data[-self.SIG_SIZE:]
        data = data[:-self.SIG_SIZE]
        if six.PY3 and not isinstance(data, bytes):
            data = salt.utils.stringutils.to_bytes(data)
        mac_bytes = hmac.new(hmac_key, data, hashlib.sha256).digest()
        if len(mac_bytes) != len(sig):
            log.debug('Failed to authenticate message')
            raise AuthenticationError('message authentication failed')
        result = 0

        if six.PY2:
            for zipped_x, zipped_y in zip(mac_bytes, sig):
                result |= ord(zipped_x) ^ ord(zipped_y)
        else:
            for zipped_x, zipped_y in zip(mac_bytes, sig):
                result |= zipped_x ^ zipped_y
        if result != 0:
            log.debug('Failed to authenticate message')
            raise AuthenticationError('message authentication failed')
        iv_bytes = data[:self.AES_BLOCK_SIZE]
        data = data[self.AES_BLOCK_SIZE:]
        if HAS_M2:
            cypher = EVP.Cipher(alg='aes_192_cbc', key=aes_key, iv=iv_bytes, op=0, padding=False)
            encr = cypher.update(data)
            data = encr + cypher.final()
        else:
            cypher = AES.new(aes_key, AES.MODE_CBC, iv_bytes)
            data = cypher.decrypt(data)
        if six.PY2:
            return data[:-ord(data[-1])]
        else:
            return data[:-data[-1]]
629416
def decrypt(self, data, decode=False):
		

		#result = self.cipher().decrypt(data)
		result = self.cipher().decrypt_block(data)

		padding = self.mode().padding()
		if padding is not None:
			result = padding.reverse_pad(result, WAESMode.__data_padding_length__)

		return result.decode() if decode else result
143656
function decrypt (input, firstKey = 0xAB) {
  const buf = Buffer.from(input);
  let key = firstKey;
  let nextKey;
  for (let i = 0; i < buf.length; i++) {
    nextKey = buf[i];
    buf[i] = buf[i] ^ key;
    key = nextKey;
  }
  return buf;
}
871420
function decryptBlock($y)
    {
        $x = ""; // 16-byte string

        // place input y into the initial state matrix in column order
        for ($i = 0; $i < 4 * $this->Nb; $i++) $this->s[$i % 4][($i - $i % $this->Nb) / $this->Nb] = ord($y[$i]);

        // add round key
        $this->addRoundKey($this->Nr);

        for ($i = $this->Nr - 1; $i > 0; $i--) {
            // inverse shift rows
            $this->invShiftRows();

            // inverse sub bytes
            $this->invSubBytes();

            // add round key
            $this->addRoundKey($i);

            // inverse mix columns
            $this->invMixColumns();
        }

        // inverse shift rows
        $this->invShiftRows();

        // inverse sub bytes
        $this->invSubBytes();

        // add round key
        $this->addRoundKey($i);

        // place state matrix s into x in column order
        for ($i = 0; $i < 4 * $this->Nb; $i++) {
            // Uncomment out the line below if your plaintext might contain
            // null characters or if you handle null characters elsewhere.
            //$x .= chr($this->s[$i%4][($i-$i%$this->Nb)/$this->Nb]);

            // Used to remove filled null characters.
            $x .= ($this->s[$i % 4][($i - $i % $this->Nb) / $this->Nb] == chr(0) ? "" : chr($this->s[$i % 4][($i - $i % $this->Nb) / $this->Nb]));
        }

        return $x;
    }
168010
def encrypt(self, plaintext):
        """"""
        if not isinstance(plaintext, int):
            raise ValueError('Plaintext must be an integer value')
        if not self.in_range.contains(plaintext):
            raise OutOfRangeError('Plaintext is not within the input range')
        return self.encrypt_recursive(plaintext, self.in_range, self.out_range)