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