Translation update done using Pootle.
[phpmyadmin/crack.git] / test / PMA_blowfish_test.php
blob234339abcda167bcc21795a27234bdd69d8ecf27
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 * Tests core.
12 require_once 'PHPUnit/Framework.php';
14 /**
15 * Include to test.
17 require_once './libraries/blowfish.php';
19 /**
20 * Test java script escaping.
22 * @package phpMyAdmin-test
24 class PMA_blowfish_test extends PHPUnit_Framework_TestCase
26 public function testEncryptDecryptNumbers()
28 $secret = '$%ÄüfuDFRR';
29 $string = '12345678';
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));