summaryrefslogtreecommitdiff
path: root/_test
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2012-05-03 00:09:09 +0200
committerAndreas Gohr <andi@splitbrain.org>2012-05-03 00:09:09 +0200
commit132fb7d3e2874932b4a3a36b5bb7815ce93f4d96 (patch)
tree3256e1b4b77359d745c474fd8f8719d8393cd9d8 /_test
parentf9f987b27c104a7dac6a4cf124c1ec637b0101b4 (diff)
downloadrpg-132fb7d3e2874932b4a3a36b5bb7815ce93f4d96.tar.gz
rpg-132fb7d3e2874932b4a3a36b5bb7815ce93f4d96.tar.bz2
added some blowfish tests
upstream plus a test for our modifications
Diffstat (limited to '_test')
-rw-r--r--_test/tests/inc/blowfish.test.php33
1 files changed, 33 insertions, 0 deletions
diff --git a/_test/tests/inc/blowfish.test.php b/_test/tests/inc/blowfish.test.php
new file mode 100644
index 000000000..972df11f4
--- /dev/null
+++ b/_test/tests/inc/blowfish.test.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * Test for blowfish encryption.
+ */
+class blowfish_test extends DokuWikiTest {
+ public function testEncryptDecryptNumbers() {
+ $secret = '$%ÄüfuDFRR';
+ $string = '12345678';
+ $this->assertEquals(
+ $string,
+ PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret)
+ );
+ }
+
+ public function testEncryptDecryptChars() {
+ $secret = '$%ÄüfuDFRR';
+ $string = 'abcDEF012!"§$%&/()=?`´"\',.;:-_#+*~öäüÖÄÜ^°²³';
+ $this->assertEquals(
+ $string,
+ PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret)
+ );
+ }
+
+ // FS#1690 FS#1713
+ public function testEncryptDecryptBinary() {
+ $secret = '$%ÄüfuDFRR';
+ $string = "this is\0binary because of\0zero bytes";
+ $this->assertEquals(
+ $string,
+ PMA_blowfish_decrypt(PMA_blowfish_encrypt($string, $secret), $secret)
+ );
+ }
+}