PageRenderTime 44ms CodeModel.GetById 20ms RepoModel.GetById 0ms 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. class Crypt_Hash_MD5Test extends Crypt_Hash_TestCase
  8. {
  9. public function getInstance()
  10. {
  11. return new phpseclib\Crypt_Hash('md5');
  12. }
  13. /**
  14. * @dataProvider hashData()
  15. */
  16. public function testHash($message, $result)
  17. {
  18. $this->assertHashesTo($this->getInstance(), $message, $result);
  19. }
  20. static public function hashData()
  21. {
  22. return array(
  23. array('', 'd41d8cd98f00b204e9800998ecf8427e'),
  24. array('The quick brown fox jumps over the lazy dog', '9e107d9d372bb6826bd81d3542a419d6'),
  25. array('The quick brown fox jumps over the lazy dog.', 'e4d909c290d0fb1ca068ffaddf22cbd0'),
  26. );
  27. }
  28. /**
  29. * @dataProvider hmacData()
  30. */
  31. public function testHMAC($key, $message, $result)
  32. {
  33. $this->assertHMACsTo($this->getInstance(), $key, $message, $result);
  34. }
  35. static public function hmacData()
  36. {
  37. return array(
  38. array('key', 'The quick brown fox jumps over the lazy dog', '80070713463e7749b90c2dc24911e275'),
  39. );
  40. }
  41. }