Translation update done using Pootle.
[phpmyadmin/ammaryasirr.git] / test / libraries / PMA_blowfish_test.php
blobd860bd05cfb56154eaa6ea3ac2c2529f8a496b97
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Test for blowfish encryption.
6 * @package phpMyAdmin-test
7 */
9 /*
10 * Include to test.
12 require_once 'libraries/blowfish.php';
14 class PMA_blowfish_test extends PHPUnit_Framework_TestCase
16 public function testEncryptDecryptNumbers()
18 $secret = '$%ÄüfuDFRR';
19 $string = '12345678';
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));