4
-- ensure consistent test output regardless of the default bytea format
5
SET bytea_output TO escape;
7
-- test vectors from RFC2144
10
SELECT encode(encrypt(
11
decode('01 23 45 67 89 AB CD EF', 'hex'),
12
decode('01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A', 'hex'),
13
'cast5-ecb/pad:none'), 'hex');
14
-- result: 23 8B 4F E5 84 7E 44 B2
17
SELECT encode(encrypt(
18
decode('01 23 45 67 89 AB CD EF', 'hex'),
19
decode('01 23 45 67 12 34 56 78 23 45', 'hex'),
20
'cast5-ecb/pad:none'), 'hex');
21
-- result: EB 6A 71 1A 2C 02 27 1B
24
SELECT encode(encrypt(
25
decode('01 23 45 67 89 AB CD EF', 'hex'),
26
decode('01 23 45 67 12', 'hex'),
27
'cast5-ecb/pad:none'), 'hex');
28
-- result: 7A C8 16 D1 6E 9B 30 2E
33
select encode( encrypt('', 'foo', 'cast5'), 'hex');
35
select encode( encrypt('foo', '0123456789', 'cast5'), 'hex');
38
select decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5');
41
select encode(encrypt_iv('foo', '0123456', 'abcd', 'cast5'), 'hex');
42
select decrypt_iv(decode('384a970695ce016a', 'hex'),
43
'0123456', 'abcd', 'cast5');
46
select encode(encrypt('Lets try a longer message.', '0123456789', 'cast5'), 'hex');
47
select decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5');