public function unwrap(string $ciphertext, string $kek): string
    {
        if (0 !== strlen($ciphertext) % 8) {
            throw new \UnexpectedValueException(
                "Ciphertext length must be a multiple of 64 bits.");
        }
        $this->_checkKEKSize($kek);
        // C = ciphertext as 64 bit blocks with integrity check value prepended
        $C = str_split($ciphertext, 8);
        list($A, $R) = $this->_unwrapBlocks($C, $kek);
        // check integrity value
        if (!hash_equals($this->_iv, $A)) {
            throw new \UnexpectedValueException("Integrity check failed.");
        }
        // output the plaintext
        $P = array_slice($R, 1, null, true);
        return implode("", $P);
    }