2005-03-21 06:24:52 +01:00
|
|
|
--
|
|
|
|
-- 3DES cipher
|
|
|
|
--
|
|
|
|
|
|
|
|
-- test vector from somewhere
|
2021-12-08 06:01:35 +01:00
|
|
|
SELECT encrypt('\x8000000000000000',
|
|
|
|
'\x010101010101010101010101010101010101010101010101',
|
|
|
|
'3des-ecb/pad:none');
|
2005-03-21 06:24:52 +01:00
|
|
|
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('', 'foo', '3des');
|
2005-03-21 06:24:52 +01:00
|
|
|
-- 10 bytes key
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('foo', '0123456789', '3des');
|
2005-03-21 06:24:52 +01:00
|
|
|
-- 22 bytes key
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('foo', '0123456789012345678901', '3des');
|
2005-03-21 06:24:52 +01:00
|
|
|
|
|
|
|
-- decrypt
|
2021-12-08 06:01:35 +01:00
|
|
|
select encode(decrypt(encrypt('foo', '0123456', '3des'), '0123456', '3des'), 'escape');
|
2005-03-21 06:24:52 +01:00
|
|
|
|
|
|
|
-- iv
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt_iv('foo', '0123456', 'abcd', '3des');
|
|
|
|
select encode(decrypt_iv('\x50735067b073bb93', '0123456', 'abcd', '3des'), 'escape');
|
2005-03-21 06:24:52 +01:00
|
|
|
|
2005-07-12 22:27:45 +02:00
|
|
|
-- long message
|
2021-12-08 06:01:35 +01:00
|
|
|
select encrypt('Lets try a longer message.', '0123456789012345678901', '3des');
|
|
|
|
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), '0123456789012345678901', '3des'), 'escape');
|