Merge remote branch 'origin/MAINT_3_3_3' into QA_3_3
[phpmyadmin/dkf.git] / test / PMA_blowfish_test.php
blob307d966ab2bfff9328cd1395ea7ada0dbc0579f5
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for blowfish encryption.
6 * @package phpMyAdmin-test
7 * @version $Id$
8 */
10 /**
11 * Tests core.
13 require_once 'PHPUnit/Framework.php';
15 /**
16 * Include to test.
18 require_once './libraries/blowfish.php';
20 /**
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';
30 $string = '12345678';
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));