2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Test for blowfish encryption.
6 * @package phpMyAdmin-test
12 require_once 'libraries/blowfish.php';
14 class PMA_blowfish_test
extends PHPUnit_Framework_TestCase
16 public function testEncryptDecryptNumbers()
18 $secret = '$%ÄüfuDFRR';
20 $this->assertEquals($string,
21 PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
24 public function testEncryptDecryptChars()
26 $secret = '$%ÄüfuDFRR';
27 $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
28 $this->assertEquals($string,
29 PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
32 /* Due to differences in the initialization factor, these tests are not portable between systems.
33 public function testEncrypt()
35 $secret = '$%ÄüfuDFRR';
36 $decrypted = '12345678';
37 $encrypted = 'kO/kc4j/nyk=';
38 $this->assertEquals($encrypted, PMA_blowfish_encrypt($decrypted, $secret));
41 public function testDecrypt()
43 $secret = '$%ÄüfuDFRR';
44 $encrypted = 'kO/kc4j/nyk=';
45 $decrypted = '12345678';
46 $this->assertEquals($decrypted, PMA_blowfish_decrypt($encrypted, $secret));