diff options
-rw-r--r-- | _test/tests/inc/blowfish.test.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/_test/tests/inc/blowfish.test.php b/_test/tests/inc/blowfish.test.php new file mode 100644 index 000000000..972df11f4 --- /dev/null +++ b/_test/tests/inc/blowfish.test.php @@ -0,0 +1,33 @@ +<?php +/** + * Test for blowfish encryption. + */ +class blowfish_test extends DokuWikiTest { + public function testEncryptDecryptNumbers() { + $secret = '$%ÄüfuDFRR'; + $string = '12345678'; + $this->assertEquals( + $string, + PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret) + ); + } + + public function testEncryptDecryptChars() { + $secret = '$%ÄüfuDFRR'; + $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³'; + $this->assertEquals( + $string, + PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret) + ); + } + + // FS#1690 FS#1713 + public function testEncryptDecryptBinary() { + $secret = '$%ÄüfuDFRR'; + $string = "this is\0binary because of\0zero bytes"; + $this->assertEquals( + $string, + PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret) + ); + } +} |