1*f1b824b5SAndreas Gohr<?php 2*f1b824b5SAndreas Gohr 3*f1b824b5SAndreas Gohr/** 4*f1b824b5SAndreas Gohr * Class PassHash_test 5*f1b824b5SAndreas Gohr * 6*f1b824b5SAndreas Gohr * most tests are in auth_password.test.php 7*f1b824b5SAndreas Gohr */ 8*f1b824b5SAndreas Gohrclass PassHash_test extends PHPUnit_Framework_TestCase { 9*f1b824b5SAndreas Gohr 10*f1b824b5SAndreas Gohr function test_hmac(){ 11*f1b824b5SAndreas Gohr // known hashes taken from https://code.google.com/p/yii/issues/detail?id=1942 12*f1b824b5SAndreas Gohr $this->assertEquals('df08aef118f36b32e29d2f47cda649b6', PassHash::hmac('md5','data','secret')); 13*f1b824b5SAndreas Gohr $this->assertEquals('9818e3306ba5ac267b5f2679fe4abd37e6cd7b54', PassHash::hmac('sha1','data','secret')); 14*f1b824b5SAndreas Gohr 15*f1b824b5SAndreas Gohr // known hashes from https://en.wikipedia.org/wiki/Hash-based_message_authentication_code 16*f1b824b5SAndreas Gohr $this->assertEquals('74e6f7298a9c2d168935f58c001bad88', PassHash::hmac('md5','','')); 17*f1b824b5SAndreas Gohr $this->assertEquals('fbdb1d1b18aa6c08324b7d64b71fb76370690e1d', PassHash::hmac('sha1','','')); 18*f1b824b5SAndreas Gohr $this->assertEquals('80070713463e7749b90c2dc24911e275', PassHash::hmac('md5','The quick brown fox jumps over the lazy dog','key')); 19*f1b824b5SAndreas Gohr $this->assertEquals('de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9', PassHash::hmac('sha1','The quick brown fox jumps over the lazy dog','key')); 20*f1b824b5SAndreas Gohr 21*f1b824b5SAndreas Gohr } 22*f1b824b5SAndreas Gohr}