| Revision 20119,
904 bytes
checked in by nanasess, 15 years ago
(diff) |
|
module 以下は svn:keywords を除外
|
-
Property svn:eol-style set to
LF
|
| Line | |
|---|
| 1 | --TEST-- |
|---|
| 2 | Function -- hash_hmac |
|---|
| 3 | --FILE-- |
|---|
| 4 | <?php |
|---|
| 5 | require_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 | |
|---|
| 10 | echo "md5: " . php_compat_hash_hmac('md5', $content, $key) . "\n"; |
|---|
| 11 | echo "sha1: " . php_compat_hash_hmac('sha1', $content, $key) . "\n"; |
|---|
| 12 | echo "sha256: " . php_compat_hash_hmac('sha256', $content, $key) . "\n"; |
|---|
| 13 | echo "md5(raw): " . bin2hex(php_compat_hash_hmac('md5', $content, $key, true)) . "\n"; |
|---|
| 14 | echo "sha256(raw): " . bin2hex(php_compat_hash_hmac('sha256', $content, $key, true)) . "\n"; |
|---|
| 15 | |
|---|
| 16 | ?> |
|---|
| 17 | --EXPECT-- |
|---|
| 18 | md5: 2a632783e2812cf23de100d7d6a463ae |
|---|
| 19 | sha1: 5bfdb62b97e2c987405463e9f7c193139c0e1fd0 |
|---|
| 20 | sha256: 49bde3496b9510a17d0edd8a4b0ac70148e32a1d51e881ec76faa96534125838 |
|---|
| 21 | md5(raw): 2a632783e2812cf23de100d7d6a463ae |
|---|
| 22 | sha256(raw): 49bde3496b9510a17d0edd8a4b0ac70148e32a1d51e881ec76faa96534125838 |
|---|
Note: See
TracBrowser
for help on using the repository browser.