3.1.3 release
[phpmyadmin/crack.git] / test / PMA_blowfish_test.php
blob4bb9d0c0aa9a897075f3747fafe5497819dc27f7
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.
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));