2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Test for blowfish encryption.
6 * @package phpMyAdmin-test
13 require_once 'PHPUnit/Framework.php';
18 require_once './libraries/blowfish.php';
21 * Test java script escaping.
23 * @package phpMyAdmin-test
25 class PMA_blowfish_test
extends PHPUnit_Framework_TestCase
27 public function testEncryptDecryptNumbers()
29 $secret = '$%ÄüfuDFRR';
31 $this->assertEquals($string,
32 PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
35 public function testEncryptDecryptChars()
37 $secret = '$%ÄüfuDFRR';
38 $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
39 $this->assertEquals($string,
40 PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
43 public function testEncrypt()
45 $secret = '$%ÄüfuDFRR';
46 $decrypted = '12345678';
47 $encrypted = 'kO/kc4j/nyk=';
48 $this->assertEquals($encrypted, PMA_blowfish_encrypt($decrypted, $secret));
51 public function testDecrypt()
53 $secret = '$%ÄüfuDFRR';
54 $encrypted = 'kO/kc4j/nyk=';
55 $decrypted = '12345678';
56 $this->assertEquals($decrypted, PMA_blowfish_decrypt($encrypted, $secret));