/** * Tests the HMAC computation * * @author Nikolaos Dimopoulos <*****@*****.**> * @since 2014-09-12 */ public function testSecurityComputeHMAC() { $this->specify('The HMAC computation values are not identical', function ($key) { $security = new Security(); $data = []; for ($i = 1; $i < 256; ++$i) { $data[] = str_repeat('a', $i); } foreach ($data as $text) { expect($security->computeHmac($text, $key, 'md5'))->equals(hash_hmac('md5', $text, $key)); } }, ['examples' => [[substr(md5('test', true), 0, strlen(md5('test', true)) / 2)], [md5('test', true)], [md5('test', true) . md5('test', true)]]]); }