PageRenderTime 288ms CodeModel.GetById 91ms app.highlight 2ms RepoModel.GetById 126ms app.codeStats 0ms

/tests/Crypt/Hash/MD5Test.php

https://github.com/kea/phpseclib
PHP | 46 lines | 30 code | 5 blank | 11 comment | 0 complexity | 41a498352cebe517495b7b68ef0a623c MD5 | raw file
 1<?php
 2/**
 3 * @author     Andreas Fischer <bantu@phpbb.com>
 4 * @copyright  MMXII Andreas Fischer
 5 * @license    http://www.opensource.org/licenses/mit-license.html  MIT License
 6 */
 7
 8class Crypt_Hash_MD5Test extends Crypt_Hash_TestCase
 9{
10	public function getInstance()
11	{
12		return new phpseclib\Crypt_Hash('md5');
13	}
14
15	/**
16	* @dataProvider hashData()
17	*/
18	public function testHash($message, $result)
19	{
20		$this->assertHashesTo($this->getInstance(), $message, $result);
21	}
22
23	static public function hashData()
24	{
25		return array(
26			array('', 'd41d8cd98f00b204e9800998ecf8427e'),
27			array('The quick brown fox jumps over the lazy dog', '9e107d9d372bb6826bd81d3542a419d6'),
28			array('The quick brown fox jumps over the lazy dog.', 'e4d909c290d0fb1ca068ffaddf22cbd0'),
29		);
30	}
31
32	/**
33	* @dataProvider hmacData()
34	*/
35	public function testHMAC($key, $message, $result)
36	{
37		$this->assertHMACsTo($this->getInstance(), $key, $message, $result);
38	}
39
40	static public function hmacData()
41	{
42		return array(
43			array('key', 'The quick brown fox jumps over the lazy dog', '80070713463e7749b90c2dc24911e275'),
44		);
45	}
46}