public function testHmac() { if (MWCryptHash::hashAlgo() !== 'whirlpool') { $this->markTestSkipped('Hash algorithm isn\'t whirlpool'); } $data = 'foobar'; $key = 'secret'; $hash = 'ddc94177b2020e55ce2049199fd9cc6327f416ff6dc621cc34cb43d9bec61d73372b4790c0e24957f565ecaf2d42821e6303619093e99cbe14a3b9250bda5f81'; $this->assertEquals(pack('H*', $hash), MWCryptHash::hmac($data, $key), 'Raw hmac'); $this->assertEquals($hash, MWCryptHash::hmac($data, $key, false), 'Hex hmac'); }