summaryrefslogtreecommitdiff
path: root/_test/tests/inc/PassHash.test.php
diff options
context:
space:
mode:
authorKlap-in <klapinklapin@gmail.com>2013-06-09 21:22:12 +0200
committerKlap-in <klapinklapin@gmail.com>2013-06-09 21:22:12 +0200
commit9b6fa49c06b538c53c9cf3e404ade82d6c003f79 (patch)
tree68771b589052382f9e4824bf3a4857f5648fdf3d /_test/tests/inc/PassHash.test.php
parenta38a6f25d7e46f47a8f358bb16c766f5b96dae45 (diff)
parent62765857f84626449d6c53b1a46c462a37e5083a (diff)
downloadrpg-9b6fa49c06b538c53c9cf3e404ade82d6c003f79.tar.gz
rpg-9b6fa49c06b538c53c9cf3e404ade82d6c003f79.tar.bz2
Merge remote-tracking branch 'origin/master' into fetchimagetokexternal
Diffstat (limited to '_test/tests/inc/PassHash.test.php')
-rw-r--r--_test/tests/inc/PassHash.test.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/_test/tests/inc/PassHash.test.php b/_test/tests/inc/PassHash.test.php
new file mode 100644
index 000000000..b6cb07090
--- /dev/null
+++ b/_test/tests/inc/PassHash.test.php
@@ -0,0 +1,22 @@
+<?php
+
+/**
+ * Class PassHash_test
+ *
+ * most tests are in auth_password.test.php
+ */
+class PassHash_test extends PHPUnit_Framework_TestCase {
+
+ function test_hmac(){
+ // known hashes taken from https://code.google.com/p/yii/issues/detail?id=1942
+ $this->assertEquals('df08aef118f36b32e29d2f47cda649b6', PassHash::hmac('md5','data','secret'));
+ $this->assertEquals('9818e3306ba5ac267b5f2679fe4abd37e6cd7b54', PassHash::hmac('sha1','data','secret'));
+
+ // known hashes from https://en.wikipedia.org/wiki/Hash-based_message_authentication_code
+ $this->assertEquals('74e6f7298a9c2d168935f58c001bad88', PassHash::hmac('md5','',''));
+ $this->assertEquals('fbdb1d1b18aa6c08324b7d64b71fb76370690e1d', PassHash::hmac('sha1','',''));
+ $this->assertEquals('80070713463e7749b90c2dc24911e275', PassHash::hmac('md5','The quick brown fox jumps over the lazy dog','key'));
+ $this->assertEquals('de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9', PassHash::hmac('sha1','The quick brown fox jumps over the lazy dog','key'));
+
+ }
+} \ No newline at end of file