source: branches/version-2_5-dev/data/module/Compat/tests/function/hash_hmac.phpt @ 20119

Revision 20119, 904 bytes checked in by nanasess, 13 years ago (diff)

module 以下は svn:keywords を除外

  • Property svn:eol-style set to LF
Line 
1--TEST--
2Function -- hash_hmac
3--FILE--
4<?php
5require_once 'PHP/Compat/Function/hash_hmac.php';
6
7$content = "This is a sample string used to test the hash_hmac function with various hashing algorithms";
8$key = 'secret';
9
10echo "md5: " . php_compat_hash_hmac('md5', $content, $key) . "\n";
11echo "sha1: " . php_compat_hash_hmac('sha1', $content, $key) . "\n";
12echo "sha256: " . php_compat_hash_hmac('sha256', $content, $key) . "\n";
13echo "md5(raw): " . bin2hex(php_compat_hash_hmac('md5', $content, $key, true)) . "\n";
14echo "sha256(raw): " . bin2hex(php_compat_hash_hmac('sha256', $content, $key, true)) . "\n";
15
16?>
17--EXPECT--
18md5: 2a632783e2812cf23de100d7d6a463ae
19sha1: 5bfdb62b97e2c987405463e9f7c193139c0e1fd0
20sha256: 49bde3496b9510a17d0edd8a4b0ac70148e32a1d51e881ec76faa96534125838
21md5(raw): 2a632783e2812cf23de100d7d6a463ae
22sha256(raw): 49bde3496b9510a17d0edd8a4b0ac70148e32a1d51e881ec76faa96534125838
Note: See TracBrowser for help on using the repository browser.