2001-10-02 00:12:23 +08:00
|
|
|
--
|
|
|
|
-- HMAC-MD5
|
|
|
|
--
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT encode(hmac(
|
2001-10-02 00:12:23 +08:00
|
|
|
'Hi There',
|
|
|
|
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
|
|
|
|
'md5'), 'hex');
|
|
|
|
encode
|
|
|
|
----------------------------------
|
|
|
|
9294727a3638bb1c13f48ef8158bfc9d
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- 2
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT encode(hmac(
|
2001-10-02 00:12:23 +08:00
|
|
|
'Jefe',
|
|
|
|
'what do ya want for nothing?',
|
|
|
|
'md5'), 'hex');
|
|
|
|
encode
|
|
|
|
----------------------------------
|
|
|
|
813aead7c4a34bff01a16d61368e7c13
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- 3
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT encode(hmac(
|
2001-10-02 00:12:23 +08:00
|
|
|
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
|
|
|
|
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
|
|
|
'md5'), 'hex');
|
|
|
|
encode
|
|
|
|
----------------------------------
|
|
|
|
56be34521d144c88dbb8c733f0e8b3f6
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- 4
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT encode(hmac(
|
2001-10-02 00:12:23 +08:00
|
|
|
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
|
|
|
|
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
|
|
|
|
'md5'), 'hex');
|
|
|
|
encode
|
|
|
|
----------------------------------
|
|
|
|
697eaf0aca3a3aea3a75164746ffaa79
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- 5
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT encode(hmac(
|
2001-10-02 00:12:23 +08:00
|
|
|
'Test With Truncation',
|
|
|
|
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
|
|
|
|
'md5'), 'hex');
|
|
|
|
encode
|
|
|
|
----------------------------------
|
|
|
|
56461ef2342edc00f9bab995690efd4c
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- 6
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT encode(hmac(
|
2001-10-02 00:12:23 +08:00
|
|
|
'Test Using Larger Than Block-Size Key - Hash Key First',
|
|
|
|
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
|
|
|
'md5'), 'hex');
|
|
|
|
encode
|
|
|
|
----------------------------------
|
|
|
|
6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd
|
|
|
|
(1 row)
|
|
|
|
|
|
|
|
-- 7
|
2002-10-19 02:41:22 +08:00
|
|
|
SELECT encode(hmac(
|
2001-10-02 00:12:23 +08:00
|
|
|
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
|
|
|
|
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
|
|
|
'md5'), 'hex');
|
|
|
|
encode
|
|
|
|
----------------------------------
|
|
|
|
6f630fad67cda0ee1fb1f562db3aa53e
|
|
|
|
(1 row)
|
|
|
|
|