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.
24 class PMA_blowfish_test
extends PHPUnit_Framework_TestCase
26 public function testEncryptDecryptNumbers()
28 $secret = '$%ÄüfuDFRR';
30 $this->assertEquals($string,
31 PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
34 public function testEncryptDecryptChars()
36 $secret = '$%ÄüfuDFRR';
37 $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
38 $this->assertEquals($string,
39 PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret));
42 public function testEncrypt()
44 $secret = '$%ÄüfuDFRR';
45 $decrypted = '12345678';
46 $encrypted = 'kO/kc4j/nyk=';
47 $this->assertEquals($encrypted, PMA_blowfish_encrypt($decrypted, $secret));
50 public function testDecrypt()
52 $secret = '$%ÄüfuDFRR';
53 $encrypted = 'kO/kc4j/nyk=';
54 $decrypted = '12345678';
55 $this->assertEquals($decrypted, PMA_blowfish_decrypt($encrypted, $secret));