public function encryptBinary(string $value, string $key): string
    {
        $key = $this->hashKey($key);
        $opts = OPENSSL_RAW_DATA | OPENSSL_ZERO_PADDING;
        $iv = random_bytes($this->ivLength);
        $encrypted = openssl_encrypt($value, $this->cipher, $key, $opts, $iv);
        if ($encrypted === false) {
            throw new \Exception("encryption failed; ".openssl_error_string());
        }
        return $iv.$encrypted;
    }