mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
pgcrypto: Remove explicit hex encoding/decoding from tests
This was from before the hex format was available in bytea. Now we can remove the extra explicit encoding/decoding calls and rely on the default output format. Discussion: https://www.postgresql.org/message-id/flat/17dcb4f7-7ac1-e2b6-d5f7-2dfba06cd9ee%40enterprisedb.com
This commit is contained in:
@ -1,31 +1,25 @@
|
||||
--
|
||||
-- 3DES cipher
|
||||
--
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
-- test vector from somewhere
|
||||
SELECT encode(encrypt(
|
||||
decode('80 00 00 00 00 00 00 00', 'hex'),
|
||||
decode('01 01 01 01 01 01 01 01
|
||||
01 01 01 01 01 01 01 01
|
||||
01 01 01 01 01 01 01 01', 'hex'),
|
||||
'3des-ecb/pad:none'), 'hex');
|
||||
-- val 95 F8 A5 E5 DD 31 D9 00
|
||||
SELECT encrypt('\x8000000000000000',
|
||||
'\x010101010101010101010101010101010101010101010101',
|
||||
'3des-ecb/pad:none');
|
||||
|
||||
select encode( encrypt('', 'foo', '3des'), 'hex');
|
||||
select encrypt('', 'foo', '3des');
|
||||
-- 10 bytes key
|
||||
select encode( encrypt('foo', '0123456789', '3des'), 'hex');
|
||||
select encrypt('foo', '0123456789', '3des');
|
||||
-- 22 bytes key
|
||||
select encode( encrypt('foo', '0123456789012345678901', '3des'), 'hex');
|
||||
select encrypt('foo', '0123456789012345678901', '3des');
|
||||
|
||||
-- decrypt
|
||||
select decrypt(encrypt('foo', '0123456', '3des'), '0123456', '3des');
|
||||
select encode(decrypt(encrypt('foo', '0123456', '3des'), '0123456', '3des'), 'escape');
|
||||
|
||||
-- iv
|
||||
select encode(encrypt_iv('foo', '0123456', 'abcd', '3des'), 'hex');
|
||||
select decrypt_iv(decode('50735067b073bb93', 'hex'), '0123456', 'abcd', '3des');
|
||||
select encrypt_iv('foo', '0123456', 'abcd', '3des');
|
||||
select encode(decrypt_iv('\x50735067b073bb93', '0123456', 'abcd', '3des'), 'escape');
|
||||
|
||||
-- long message
|
||||
select encode(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), 'hex');
|
||||
select decrypt(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), '0123456789012345678901', '3des');
|
||||
select encrypt('Lets try a longer message.', '0123456789012345678901', '3des');
|
||||
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), '0123456789012345678901', '3des'), 'escape');
|
||||
|
@ -1,92 +1,53 @@
|
||||
--
|
||||
-- Blowfish cipher
|
||||
--
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
-- some standard Blowfish testvalues
|
||||
SELECT encode(encrypt(
|
||||
decode('0000000000000000', 'hex'),
|
||||
decode('0000000000000000', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('ffffffffffffffff', 'hex'),
|
||||
decode('ffffffffffffffff', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('1000000000000001', 'hex'),
|
||||
decode('3000000000000000', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('1111111111111111', 'hex'),
|
||||
decode('1111111111111111', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('0123456789abcdef', 'hex'),
|
||||
decode('fedcba9876543210', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('01a1d6d039776742', 'hex'),
|
||||
decode('fedcba9876543210', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('ffffffffffffffff', 'hex'),
|
||||
decode('0000000000000000', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
SELECT encrypt('\x0000000000000000', '\x0000000000000000', 'bf-ecb/pad:none');
|
||||
SELECT encrypt('\xffffffffffffffff', '\xffffffffffffffff', 'bf-ecb/pad:none');
|
||||
SELECT encrypt('\x1000000000000001', '\x3000000000000000', 'bf-ecb/pad:none');
|
||||
SELECT encrypt('\x1111111111111111', '\x1111111111111111', 'bf-ecb/pad:none');
|
||||
SELECT encrypt('\x0123456789abcdef', '\xfedcba9876543210', 'bf-ecb/pad:none');
|
||||
SELECT encrypt('\x01a1d6d039776742', '\xfedcba9876543210', 'bf-ecb/pad:none');
|
||||
SELECT encrypt('\xffffffffffffffff', '\x0000000000000000', 'bf-ecb/pad:none');
|
||||
|
||||
-- setkey
|
||||
SELECT encode(encrypt(
|
||||
decode('fedcba9876543210', 'hex'),
|
||||
decode('f0e1d2c3b4a5968778695a4b3c2d1e0f', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
SELECT encrypt('\xfedcba9876543210', '\xf0e1d2c3b4a5968778695a4b3c2d1e0f', 'bf-ecb/pad:none');
|
||||
|
||||
-- with padding
|
||||
SELECT encode(encrypt(
|
||||
decode('01234567890123456789', 'hex'),
|
||||
decode('33443344334433443344334433443344', 'hex'),
|
||||
'bf-ecb'), 'hex');
|
||||
SELECT encrypt('\x01234567890123456789', '\x33443344334433443344334433443344', 'bf-ecb');
|
||||
|
||||
-- cbc
|
||||
|
||||
-- 28 bytes key
|
||||
SELECT encode(encrypt(
|
||||
decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5', 'hex'),
|
||||
decode('37363534333231204e6f77206973207468652074696d6520666f7220', 'hex'),
|
||||
'bf-cbc'), 'hex');
|
||||
SELECT encrypt('\x6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5',
|
||||
'\x37363534333231204e6f77206973207468652074696d6520666f7220',
|
||||
'bf-cbc');
|
||||
|
||||
-- 29 bytes key
|
||||
SELECT encode(encrypt(
|
||||
decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc', 'hex'),
|
||||
decode('37363534333231204e6f77206973207468652074696d6520666f722000', 'hex'),
|
||||
'bf-cbc'), 'hex');
|
||||
SELECT encrypt('\x6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc',
|
||||
'\x37363534333231204e6f77206973207468652074696d6520666f722000',
|
||||
'bf-cbc');
|
||||
|
||||
-- blowfish-448
|
||||
SELECT encode(encrypt(
|
||||
decode('fedcba9876543210', 'hex'),
|
||||
decode('f0e1d2c3b4a5968778695a4b3c2d1e0f001122334455667704689104c2fd3b2f584023641aba61761f1f1f1f0e0e0e0effffffffffffffff', 'hex'),
|
||||
'bf-ecb/pad:none'), 'hex');
|
||||
-- result: c04504012e4e1f53
|
||||
SELECT encrypt('\xfedcba9876543210',
|
||||
'\xf0e1d2c3b4a5968778695a4b3c2d1e0f001122334455667704689104c2fd3b2f584023641aba61761f1f1f1f0e0e0e0effffffffffffffff',
|
||||
'bf-ecb/pad:none');
|
||||
|
||||
-- empty data
|
||||
select encode(encrypt('', 'foo', 'bf'), 'hex');
|
||||
select encrypt('', 'foo', 'bf');
|
||||
-- 10 bytes key
|
||||
select encode(encrypt('foo', '0123456789', 'bf'), 'hex');
|
||||
select encrypt('foo', '0123456789', 'bf');
|
||||
-- 22 bytes key
|
||||
select encode(encrypt('foo', '0123456789012345678901', 'bf'), 'hex');
|
||||
select encrypt('foo', '0123456789012345678901', 'bf');
|
||||
|
||||
-- decrypt
|
||||
select decrypt(encrypt('foo', '0123456', 'bf'), '0123456', 'bf');
|
||||
select encode(decrypt(encrypt('foo', '0123456', 'bf'), '0123456', 'bf'), 'escape');
|
||||
|
||||
-- iv
|
||||
select encode(encrypt_iv('foo', '0123456', 'abcd', 'bf'), 'hex');
|
||||
select decrypt_iv(decode('95c7e89322525d59', 'hex'), '0123456', 'abcd', 'bf');
|
||||
select encrypt_iv('foo', '0123456', 'abcd', 'bf');
|
||||
select encode(decrypt_iv('\x95c7e89322525d59', '0123456', 'abcd', 'bf'), 'escape');
|
||||
|
||||
-- long message
|
||||
select encode(encrypt('Lets try a longer message.', '0123456789', 'bf'), 'hex');
|
||||
select decrypt(encrypt('Lets try a longer message.', '0123456789', 'bf'), '0123456789', 'bf');
|
||||
select encrypt('Lets try a longer message.', '0123456789', 'bf');
|
||||
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789', 'bf'), '0123456789', 'bf'), 'escape');
|
||||
|
@ -1,47 +1,32 @@
|
||||
--
|
||||
-- Cast5 cipher
|
||||
--
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
-- test vectors from RFC2144
|
||||
|
||||
-- 128 bit key
|
||||
SELECT encode(encrypt(
|
||||
decode('01 23 45 67 89 AB CD EF', 'hex'),
|
||||
decode('01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A', 'hex'),
|
||||
'cast5-ecb/pad:none'), 'hex');
|
||||
-- result: 23 8B 4F E5 84 7E 44 B2
|
||||
SELECT encrypt('\x0123456789ABCDEF', '\x0123456712345678234567893456789A', 'cast5-ecb/pad:none');
|
||||
|
||||
-- 80 bit key
|
||||
SELECT encode(encrypt(
|
||||
decode('01 23 45 67 89 AB CD EF', 'hex'),
|
||||
decode('01 23 45 67 12 34 56 78 23 45', 'hex'),
|
||||
'cast5-ecb/pad:none'), 'hex');
|
||||
-- result: EB 6A 71 1A 2C 02 27 1B
|
||||
SELECT encrypt('\x0123456789ABCDEF', '\x01234567123456782345', 'cast5-ecb/pad:none');
|
||||
|
||||
-- 40 bit key
|
||||
SELECT encode(encrypt(
|
||||
decode('01 23 45 67 89 AB CD EF', 'hex'),
|
||||
decode('01 23 45 67 12', 'hex'),
|
||||
'cast5-ecb/pad:none'), 'hex');
|
||||
-- result: 7A C8 16 D1 6E 9B 30 2E
|
||||
SELECT encrypt('\x0123456789ABCDEF', '\x0123456712', 'cast5-ecb/pad:none');
|
||||
|
||||
-- cbc
|
||||
|
||||
-- empty data
|
||||
select encode( encrypt('', 'foo', 'cast5'), 'hex');
|
||||
select encrypt('', 'foo', 'cast5');
|
||||
-- 10 bytes key
|
||||
select encode( encrypt('foo', '0123456789', 'cast5'), 'hex');
|
||||
select encrypt('foo', '0123456789', 'cast5');
|
||||
|
||||
-- decrypt
|
||||
select decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5');
|
||||
select encode(decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5'), 'escape');
|
||||
|
||||
-- iv
|
||||
select encode(encrypt_iv('foo', '0123456', 'abcd', 'cast5'), 'hex');
|
||||
select decrypt_iv(decode('384a970695ce016a', 'hex'),
|
||||
'0123456', 'abcd', 'cast5');
|
||||
select encrypt_iv('foo', '0123456', 'abcd', 'cast5');
|
||||
select encode(decrypt_iv('\x384a970695ce016a', '0123456', 'abcd', 'cast5'), 'escape');
|
||||
|
||||
-- long message
|
||||
select encode(encrypt('Lets try a longer message.', '0123456789', 'cast5'), 'hex');
|
||||
select decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5');
|
||||
select encrypt('Lets try a longer message.', '0123456789', 'cast5');
|
||||
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5'), 'escape');
|
||||
|
@ -1,29 +1,24 @@
|
||||
--
|
||||
-- DES cipher
|
||||
--
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
-- no official test vectors atm
|
||||
|
||||
-- from blowfish.sql
|
||||
SELECT encode(encrypt(
|
||||
decode('0123456789abcdef', 'hex'),
|
||||
decode('fedcba9876543210', 'hex'),
|
||||
'des-ecb/pad:none'), 'hex');
|
||||
SELECT encrypt('\x0123456789abcdef', '\xfedcba9876543210', 'des-ecb/pad:none');
|
||||
|
||||
-- empty data
|
||||
select encode( encrypt('', 'foo', 'des'), 'hex');
|
||||
select encrypt('', 'foo', 'des');
|
||||
-- 8 bytes key
|
||||
select encode( encrypt('foo', '01234589', 'des'), 'hex');
|
||||
select encrypt('foo', '01234589', 'des');
|
||||
|
||||
-- decrypt
|
||||
select decrypt(encrypt('foo', '0123456', 'des'), '0123456', 'des');
|
||||
select encode(decrypt(encrypt('foo', '0123456', 'des'), '0123456', 'des'), 'escape');
|
||||
|
||||
-- iv
|
||||
select encode(encrypt_iv('foo', '0123456', 'abcd', 'des'), 'hex');
|
||||
select decrypt_iv(decode('50735067b073bb93', 'hex'), '0123456', 'abcd', 'des');
|
||||
select encrypt_iv('foo', '0123456', 'abcd', 'des');
|
||||
select encode(decrypt_iv('\x50735067b073bb93', '0123456', 'abcd', 'des'), 'escape');
|
||||
|
||||
-- long message
|
||||
select encode(encrypt('Lets try a longer message.', '01234567', 'des'), 'hex');
|
||||
select decrypt(encrypt('Lets try a longer message.', '01234567', 'des'), '01234567', 'des');
|
||||
select encrypt('Lets try a longer message.', '01234567', 'des');
|
||||
select encode(decrypt(encrypt('Lets try a longer message.', '01234567', 'des'), '01234567', 'des'), 'escape');
|
||||
|
@ -2,43 +2,43 @@
|
||||
-- HMAC-MD5
|
||||
--
|
||||
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Hi There',
|
||||
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
|
||||
'md5'), 'hex');
|
||||
'\x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'::bytea,
|
||||
'md5');
|
||||
|
||||
-- 2
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Jefe',
|
||||
'what do ya want for nothing?',
|
||||
'md5'), 'hex');
|
||||
'md5');
|
||||
|
||||
-- 3
|
||||
SELECT encode(hmac(
|
||||
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
|
||||
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
||||
'md5'), 'hex');
|
||||
SELECT hmac(
|
||||
'\xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'::bytea,
|
||||
'\xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'::bytea,
|
||||
'md5');
|
||||
|
||||
-- 4
|
||||
SELECT encode(hmac(
|
||||
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
|
||||
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
|
||||
'md5'), 'hex');
|
||||
SELECT hmac(
|
||||
'\xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd'::bytea,
|
||||
'\x0102030405060708090a0b0c0d0e0f10111213141516171819'::bytea,
|
||||
'md5');
|
||||
|
||||
-- 5
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Test With Truncation',
|
||||
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
|
||||
'md5'), 'hex');
|
||||
'\x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c'::bytea,
|
||||
'md5');
|
||||
|
||||
-- 6
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Test Using Larger Than Block-Size Key - Hash Key First',
|
||||
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
||||
'md5'), 'hex');
|
||||
'\xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'::bytea,
|
||||
'md5');
|
||||
|
||||
-- 7
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
|
||||
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
||||
'md5'), 'hex');
|
||||
'\xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'::bytea,
|
||||
'md5');
|
||||
|
@ -2,43 +2,43 @@
|
||||
-- HMAC-SHA1
|
||||
--
|
||||
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Hi There',
|
||||
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
|
||||
'sha1'), 'hex');
|
||||
'\x0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'::bytea,
|
||||
'sha1');
|
||||
|
||||
-- 2
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Jefe',
|
||||
'what do ya want for nothing?',
|
||||
'sha1'), 'hex');
|
||||
'sha1');
|
||||
|
||||
-- 3
|
||||
SELECT encode(hmac(
|
||||
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
|
||||
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
||||
'sha1'), 'hex');
|
||||
SELECT hmac(
|
||||
'\xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'::bytea,
|
||||
'\xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'::bytea,
|
||||
'sha1');
|
||||
|
||||
-- 4
|
||||
SELECT encode(hmac(
|
||||
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
|
||||
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
|
||||
'sha1'), 'hex');
|
||||
SELECT hmac(
|
||||
'\xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd'::bytea,
|
||||
'\x0102030405060708090a0b0c0d0e0f10111213141516171819'::bytea,
|
||||
'sha1');
|
||||
|
||||
-- 5
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Test With Truncation',
|
||||
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
|
||||
'sha1'), 'hex');
|
||||
'\x0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c'::bytea,
|
||||
'sha1');
|
||||
|
||||
-- 6
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Test Using Larger Than Block-Size Key - Hash Key First',
|
||||
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
||||
'sha1'), 'hex');
|
||||
'\xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'::bytea,
|
||||
'sha1');
|
||||
|
||||
-- 7
|
||||
SELECT encode(hmac(
|
||||
SELECT hmac(
|
||||
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
|
||||
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
|
||||
'sha1'), 'hex');
|
||||
'\xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'::bytea,
|
||||
'sha1');
|
||||
|
@ -4,13 +4,6 @@
|
||||
|
||||
CREATE EXTENSION pgcrypto;
|
||||
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
-- check for encoding fn's
|
||||
SELECT encode('foo', 'hex');
|
||||
SELECT decode('666f6f', 'hex');
|
||||
|
||||
-- check error handling
|
||||
select gen_salt('foo');
|
||||
select digest('foo', 'foo');
|
||||
|
@ -2,10 +2,10 @@
|
||||
-- MD5 message digest
|
||||
--
|
||||
|
||||
SELECT encode(digest('', 'md5'), 'hex');
|
||||
SELECT encode(digest('a', 'md5'), 'hex');
|
||||
SELECT encode(digest('abc', 'md5'), 'hex');
|
||||
SELECT encode(digest('message digest', 'md5'), 'hex');
|
||||
SELECT encode(digest('abcdefghijklmnopqrstuvwxyz', 'md5'), 'hex');
|
||||
SELECT encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'md5'), 'hex');
|
||||
SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'md5'), 'hex');
|
||||
SELECT digest('', 'md5');
|
||||
SELECT digest('a', 'md5');
|
||||
SELECT digest('abc', 'md5');
|
||||
SELECT digest('message digest', 'md5');
|
||||
SELECT digest('abcdefghijklmnopqrstuvwxyz', 'md5');
|
||||
SELECT digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'md5');
|
||||
SELECT digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'md5');
|
||||
|
@ -1,19 +1,17 @@
|
||||
--
|
||||
-- PGP Armor
|
||||
--
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
select armor('');
|
||||
select armor('test');
|
||||
select dearmor(armor(''));
|
||||
select dearmor(armor('zooka'));
|
||||
select encode(dearmor(armor('')), 'escape');
|
||||
select encode(dearmor(armor('zooka')), 'escape');
|
||||
|
||||
select armor('0123456789abcdef0123456789abcdef0123456789abcdef
|
||||
0123456789abcdef0123456789abcdef0123456789abcdef');
|
||||
|
||||
-- lots formatting
|
||||
select dearmor(' a pgp msg:
|
||||
select encode(dearmor(' a pgp msg:
|
||||
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
Comment: Some junk
|
||||
@ -22,10 +20,10 @@ em9va2E=
|
||||
|
||||
=D5cR
|
||||
|
||||
-----END PGP MESSAGE-----');
|
||||
-----END PGP MESSAGE-----'), 'escape');
|
||||
|
||||
-- lots messages
|
||||
select dearmor('
|
||||
select encode(dearmor('
|
||||
wrong packet:
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
|
||||
@ -46,7 +44,7 @@ use only first packet
|
||||
d3Jvbmc=
|
||||
=vCYP
|
||||
-----END PGP MESSAGE-----
|
||||
');
|
||||
'), 'escape');
|
||||
|
||||
-- bad crc
|
||||
select dearmor('
|
||||
|
@ -208,7 +208,7 @@ FwsDabdQUz5O7bgNSnxfmyw1OifGF+W2bIn/8W+0rDf8u3+O+Q==
|
||||
'), 'x');
|
||||
|
||||
-- Checking various data
|
||||
select encode(digest(pgp_sym_decrypt(dearmor('
|
||||
select digest(pgp_sym_decrypt(dearmor('
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
Comment: dat1.aes.sha1.mdc.s2k3.z0
|
||||
|
||||
@ -216,10 +216,9 @@ jA0EBwMCGJ+SpuOysINg0kQBJfSjzsW0x4OVcAyr17O7FBvMTwIGeGcJd99oTQU8
|
||||
Xtx3kDqnhUq9Z1fS3qPbi5iNP2A9NxOBxPWz2JzxhydANlgbxg==
|
||||
=W/ik
|
||||
-----END PGP MESSAGE-----
|
||||
'), '0123456789abcdefghij'), 'sha1'), 'hex');
|
||||
-- expected: 0225e3ede6f2587b076d021a189ff60aad67e066
|
||||
'), '0123456789abcdefghij'), 'sha1');
|
||||
|
||||
select encode(digest(pgp_sym_decrypt(dearmor('
|
||||
select digest(pgp_sym_decrypt(dearmor('
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
Comment: dat2.aes.sha1.mdc.s2k3.z0
|
||||
|
||||
@ -227,10 +226,9 @@ jA0EBwMCvdpDvidNzMxg0jUBvj8eS2+1t/9/zgemxvhtc0fvdKGGbjH7dleaTJRB
|
||||
SaV9L04ky1qECNDx3XjnoKLC+H7IOQ==
|
||||
=Fxen
|
||||
-----END PGP MESSAGE-----
|
||||
'), '0123456789abcdefghij'), 'sha1'), 'hex');
|
||||
-- expected: da39a3ee5e6b4b0d3255bfef95601890afd80709
|
||||
'), '0123456789abcdefghij'), 'sha1');
|
||||
|
||||
select encode(digest(pgp_sym_decrypt(dearmor('
|
||||
select digest(pgp_sym_decrypt(dearmor('
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
Comment: dat3.aes.sha1.mdc.s2k3.z0
|
||||
|
||||
@ -239,11 +237,10 @@ gFnkUKIE0PSaYFp+Yi1VlRfUtRQ/X/LYNGa7tWZS+4VQajz2Xtz4vUeAEiYFYPXk
|
||||
73Hb8m1yRhQK
|
||||
=ivrD
|
||||
-----END PGP MESSAGE-----
|
||||
'), '0123456789abcdefghij'), 'sha1'), 'hex');
|
||||
-- expected: 5e5c135efc0dd00633efc6dfd6e731ea408a5b4c
|
||||
'), '0123456789abcdefghij'), 'sha1');
|
||||
|
||||
-- Checking CRLF
|
||||
select encode(digest(pgp_sym_decrypt(dearmor('
|
||||
select digest(pgp_sym_decrypt(dearmor('
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
Comment: crlf mess
|
||||
|
||||
@ -251,10 +248,9 @@ ww0ECQMCt7VAtby6l4Bi0lgB5KMIZiiF/b3CfMfUyY0eDncsGXtkbu1X+l9brjpMP8eJnY79Amms
|
||||
a3nsOzKTXUfS9VyaXo8IrncM6n7fdaXpwba/3tNsAhJG4lDv1k4g9v8Ix2dfv6Rs
|
||||
=mBP9
|
||||
-----END PGP MESSAGE-----
|
||||
'), 'key', 'convert-crlf=0'), 'sha1'), 'hex');
|
||||
-- expected: 9353062be7720f1446d30b9e75573a4833886784
|
||||
'), 'key', 'convert-crlf=0'), 'sha1');
|
||||
|
||||
select encode(digest(pgp_sym_decrypt(dearmor('
|
||||
select digest(pgp_sym_decrypt(dearmor('
|
||||
-----BEGIN PGP MESSAGE-----
|
||||
Comment: crlf mess
|
||||
|
||||
@ -262,12 +258,10 @@ ww0ECQMCt7VAtby6l4Bi0lgB5KMIZiiF/b3CfMfUyY0eDncsGXtkbu1X+l9brjpMP8eJnY79Amms
|
||||
a3nsOzKTXUfS9VyaXo8IrncM6n7fdaXpwba/3tNsAhJG4lDv1k4g9v8Ix2dfv6Rs
|
||||
=mBP9
|
||||
-----END PGP MESSAGE-----
|
||||
'), 'key', 'convert-crlf=1'), 'sha1'), 'hex');
|
||||
-- expected: 7efefcab38467f7484d6fa43dc86cf5281bd78e2
|
||||
'), 'key', 'convert-crlf=1'), 'sha1');
|
||||
|
||||
-- check BUG #11905, problem with messages 6 less than a power of 2.
|
||||
select pgp_sym_decrypt(pgp_sym_encrypt(repeat('x',65530),'1'),'1') = repeat('x',65530);
|
||||
-- expected: true
|
||||
|
||||
|
||||
-- Negative tests
|
||||
|
@ -1,8 +1,6 @@
|
||||
--
|
||||
-- PGP encrypt
|
||||
--
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'), 'key');
|
||||
|
||||
@ -30,7 +28,7 @@ select pgp_sym_decrypt(pgp_sym_encrypt('Secret.', 'key'),
|
||||
select pgp_sym_decrypt(pgp_sym_encrypt_bytea('Binary', 'baz'), 'baz');
|
||||
|
||||
-- text as bytea
|
||||
select pgp_sym_decrypt_bytea(pgp_sym_encrypt('Text', 'baz'), 'baz');
|
||||
select encode(pgp_sym_decrypt_bytea(pgp_sym_encrypt('Text', 'baz'), 'baz'), 'escape');
|
||||
|
||||
|
||||
-- algorithm change
|
||||
@ -95,12 +93,12 @@ select pgp_sym_decrypt(
|
||||
'key', 'expect-disable-mdc=1');
|
||||
|
||||
-- crlf
|
||||
select encode(pgp_sym_decrypt_bytea(
|
||||
select pgp_sym_decrypt_bytea(
|
||||
pgp_sym_encrypt(E'1\n2\n3\r\n', 'key', 'convert-crlf=1'),
|
||||
'key'), 'hex');
|
||||
'key');
|
||||
|
||||
-- conversion should be lossless
|
||||
select encode(digest(pgp_sym_decrypt(
|
||||
select digest(pgp_sym_decrypt(
|
||||
pgp_sym_encrypt(E'\r\n0\n1\r\r\n\n2\r', 'key', 'convert-crlf=1'),
|
||||
'key', 'convert-crlf=1'), 'sha1'), 'hex') as result,
|
||||
encode(digest(E'\r\n0\n1\r\r\n\n2\r', 'sha1'), 'hex') as expect;
|
||||
'key', 'convert-crlf=1'), 'sha1') as result,
|
||||
digest(E'\r\n0\n1\r\r\n\n2\r', 'sha1') as expect;
|
||||
|
@ -1,8 +1,6 @@
|
||||
--
|
||||
-- PGP Public Key Encryption
|
||||
--
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
-- successful encrypt/decrypt
|
||||
select pgp_pub_decrypt(
|
||||
@ -38,9 +36,9 @@ select pgp_pub_decrypt(
|
||||
from keytbl where keytbl.id=1;
|
||||
|
||||
-- does text-to-bytea works
|
||||
select pgp_pub_decrypt_bytea(
|
||||
select encode(pgp_pub_decrypt_bytea(
|
||||
pgp_pub_encrypt('Secret msg', dearmor(pubkey)),
|
||||
dearmor(seckey))
|
||||
dearmor(seckey)), 'escape')
|
||||
from keytbl where keytbl.id=1;
|
||||
|
||||
-- and bytea-to-text?
|
||||
|
@ -1,63 +1,60 @@
|
||||
--
|
||||
-- AES cipher (aka Rijndael-128, -192, or -256)
|
||||
--
|
||||
-- ensure consistent test output regardless of the default bytea format
|
||||
SET bytea_output TO escape;
|
||||
|
||||
-- some standard Rijndael testvalues
|
||||
SELECT encode(encrypt(
|
||||
decode('00112233445566778899aabbccddeeff', 'hex'),
|
||||
decode('000102030405060708090a0b0c0d0e0f', 'hex'),
|
||||
'aes-ecb/pad:none'), 'hex');
|
||||
SELECT encrypt(
|
||||
'\x00112233445566778899aabbccddeeff',
|
||||
'\x000102030405060708090a0b0c0d0e0f',
|
||||
'aes-ecb/pad:none');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('00112233445566778899aabbccddeeff', 'hex'),
|
||||
decode('000102030405060708090a0b0c0d0e0f1011121314151617', 'hex'),
|
||||
'aes-ecb/pad:none'), 'hex');
|
||||
SELECT encrypt(
|
||||
'\x00112233445566778899aabbccddeeff',
|
||||
'\x000102030405060708090a0b0c0d0e0f1011121314151617',
|
||||
'aes-ecb/pad:none');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('00112233445566778899aabbccddeeff', 'hex'),
|
||||
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'),
|
||||
'aes-ecb/pad:none'), 'hex');
|
||||
SELECT encrypt(
|
||||
'\x00112233445566778899aabbccddeeff',
|
||||
'\x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f',
|
||||
'aes-ecb/pad:none');
|
||||
|
||||
-- cbc
|
||||
SELECT encode(encrypt(
|
||||
decode('00112233445566778899aabbccddeeff', 'hex'),
|
||||
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'),
|
||||
'aes-cbc/pad:none'), 'hex');
|
||||
SELECT encrypt(
|
||||
'\x00112233445566778899aabbccddeeff',
|
||||
'\x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f',
|
||||
'aes-cbc/pad:none');
|
||||
|
||||
-- key padding
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('0011223344', 'hex'),
|
||||
decode('000102030405', 'hex'),
|
||||
'aes-cbc'), 'hex');
|
||||
SELECT encrypt(
|
||||
'\x0011223344',
|
||||
'\x000102030405',
|
||||
'aes-cbc');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('0011223344', 'hex'),
|
||||
decode('000102030405060708090a0b0c0d0e0f10111213', 'hex'),
|
||||
'aes-cbc'), 'hex');
|
||||
SELECT encrypt(
|
||||
'\x0011223344',
|
||||
'\x000102030405060708090a0b0c0d0e0f10111213',
|
||||
'aes-cbc');
|
||||
|
||||
SELECT encode(encrypt(
|
||||
decode('0011223344', 'hex'),
|
||||
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b', 'hex'),
|
||||
'aes-cbc'), 'hex');
|
||||
SELECT encrypt(
|
||||
'\x0011223344',
|
||||
'\x000102030405060708090a0b0c0d0e0f101112131415161718191a1b',
|
||||
'aes-cbc');
|
||||
|
||||
-- empty data
|
||||
select encode(encrypt('', 'foo', 'aes'), 'hex');
|
||||
select encrypt('', 'foo', 'aes');
|
||||
-- 10 bytes key
|
||||
select encode(encrypt('foo', '0123456789', 'aes'), 'hex');
|
||||
select encrypt('foo', '0123456789', 'aes');
|
||||
-- 22 bytes key
|
||||
select encode(encrypt('foo', '0123456789012345678901', 'aes'), 'hex');
|
||||
select encrypt('foo', '0123456789012345678901', 'aes');
|
||||
|
||||
-- decrypt
|
||||
select decrypt(encrypt('foo', '0123456', 'aes'), '0123456', 'aes');
|
||||
select encode(decrypt(encrypt('foo', '0123456', 'aes'), '0123456', 'aes'), 'escape');
|
||||
|
||||
-- iv
|
||||
select encode(encrypt_iv('foo', '0123456', 'abcd', 'aes'), 'hex');
|
||||
select decrypt_iv(decode('2c24cb7da91d6d5699801268b0f5adad', 'hex'),
|
||||
'0123456', 'abcd', 'aes');
|
||||
select encrypt_iv('foo', '0123456', 'abcd', 'aes');
|
||||
select encode(decrypt_iv('\x2c24cb7da91d6d5699801268b0f5adad', '0123456', 'abcd', 'aes'), 'escape');
|
||||
|
||||
-- long message
|
||||
select encode(encrypt('Lets try a longer message.', '0123456789', 'aes'), 'hex');
|
||||
select decrypt(encrypt('Lets try a longer message.', '0123456789', 'aes'), '0123456789', 'aes');
|
||||
select encrypt('Lets try a longer message.', '0123456789', 'aes');
|
||||
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789', 'aes'), '0123456789', 'aes'), 'escape');
|
||||
|
@ -2,10 +2,10 @@
|
||||
-- SHA1 message digest
|
||||
--
|
||||
|
||||
SELECT encode(digest('', 'sha1'), 'hex');
|
||||
SELECT encode(digest('a', 'sha1'), 'hex');
|
||||
SELECT encode(digest('abc', 'sha1'), 'hex');
|
||||
SELECT encode(digest('message digest', 'sha1'), 'hex');
|
||||
SELECT encode(digest('abcdefghijklmnopqrstuvwxyz', 'sha1'), 'hex');
|
||||
SELECT encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'sha1'), 'hex');
|
||||
SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha1'), 'hex');
|
||||
SELECT digest('', 'sha1');
|
||||
SELECT digest('a', 'sha1');
|
||||
SELECT digest('abc', 'sha1');
|
||||
SELECT digest('message digest', 'sha1');
|
||||
SELECT digest('abcdefghijklmnopqrstuvwxyz', 'sha1');
|
||||
SELECT digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'sha1');
|
||||
SELECT digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha1');
|
||||
|
@ -3,31 +3,31 @@
|
||||
--
|
||||
|
||||
-- SHA224
|
||||
SELECT encode(digest('', 'sha224'), 'hex');
|
||||
SELECT encode(digest('a', 'sha224'), 'hex');
|
||||
SELECT encode(digest('abc', 'sha224'), 'hex');
|
||||
SELECT encode(digest('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 'sha224'), 'hex');
|
||||
SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha224'), 'hex');
|
||||
SELECT digest('', 'sha224');
|
||||
SELECT digest('a', 'sha224');
|
||||
SELECT digest('abc', 'sha224');
|
||||
SELECT digest('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 'sha224');
|
||||
SELECT digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha224');
|
||||
|
||||
-- SHA256
|
||||
SELECT encode(digest('', 'sha256'), 'hex');
|
||||
SELECT encode(digest('a', 'sha256'), 'hex');
|
||||
SELECT encode(digest('abc', 'sha256'), 'hex');
|
||||
SELECT encode(digest('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 'sha256'), 'hex');
|
||||
SELECT encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha256'), 'hex');
|
||||
SELECT digest('', 'sha256');
|
||||
SELECT digest('a', 'sha256');
|
||||
SELECT digest('abc', 'sha256');
|
||||
SELECT digest('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 'sha256');
|
||||
SELECT digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha256');
|
||||
|
||||
-- SHA384
|
||||
SELECT encode(digest('', 'sha384'), 'hex');
|
||||
SELECT encode(digest('a', 'sha384'), 'hex');
|
||||
SELECT encode(digest('abc', 'sha384'), 'hex');
|
||||
SELECT encode(digest('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 'sha384'), 'hex');
|
||||
SELECT encode(digest('abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', 'sha384'), 'hex');
|
||||
SELECT encode(digest('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', 'sha384'), 'hex');
|
||||
SELECT digest('', 'sha384');
|
||||
SELECT digest('a', 'sha384');
|
||||
SELECT digest('abc', 'sha384');
|
||||
SELECT digest('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 'sha384');
|
||||
SELECT digest('abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', 'sha384');
|
||||
SELECT digest('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', 'sha384');
|
||||
|
||||
-- SHA512
|
||||
SELECT encode(digest('', 'sha512'), 'hex');
|
||||
SELECT encode(digest('a', 'sha512'), 'hex');
|
||||
SELECT encode(digest('abc', 'sha512'), 'hex');
|
||||
SELECT encode(digest('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 'sha512'), 'hex');
|
||||
SELECT encode(digest('abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', 'sha512'), 'hex');
|
||||
SELECT encode(digest('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', 'sha512'), 'hex');
|
||||
SELECT digest('', 'sha512');
|
||||
SELECT digest('a', 'sha512');
|
||||
SELECT digest('abc', 'sha512');
|
||||
SELECT digest('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq', 'sha512');
|
||||
SELECT digest('abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu', 'sha512');
|
||||
SELECT digest('abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz', 'sha512');
|
||||
|
Reference in New Issue
Block a user