xref: /PHP-8.0/ext/openssl/tests/bug72362.phpt (revision 3c42f64e)
1--TEST--
2Bug #72362: OpenSSL Blowfish encryption is incorrect for short keys
3--SKIPIF--
4<?php
5if (!extension_loaded("openssl")) die("skip openssl not loaded");
6?>
7--FILE--
8<?php
9var_dump(
10    bin2hex(
11        openssl_encrypt(
12            "this is a test string",
13            "bf-ecb",
14            "12345678",
15            OPENSSL_RAW_DATA | OPENSSL_DONT_ZERO_PAD_KEY
16        )
17    )
18);
19var_dump(
20    bin2hex(
21        openssl_encrypt(
22            "this is a test string",
23            "bf-ecb",
24            "1234567812345678",
25            OPENSSL_RAW_DATA
26        )
27    )
28);
29?>
30--EXPECT--
31string(48) "e3214d1b16e574828c8a3e222202dde81afd1ad2cb165ab3"
32string(48) "e3214d1b16e574828c8a3e222202dde81afd1ad2cb165ab3"
33