| 1 |
-- |
| 2 |
-- Cast5 cipher |
| 3 |
-- |
| 4 |
|
| 5 |
-- test vectors from RFC2144 |
| 6 |
|
| 7 |
-- 128 bit key |
| 8 |
SELECT encrypt('\x0123456789ABCDEF', '\x0123456712345678234567893456789A', 'cast5-ecb/pad:none'); |
| 9 |
|
| 10 |
-- 80 bit key |
| 11 |
SELECT encrypt('\x0123456789ABCDEF', '\x01234567123456782345', 'cast5-ecb/pad:none'); |
| 12 |
|
| 13 |
-- 40 bit key |
| 14 |
SELECT encrypt('\x0123456789ABCDEF', '\x0123456712', 'cast5-ecb/pad:none'); |
| 15 |
|
| 16 |
-- cbc |
| 17 |
|
| 18 |
-- empty data |
| 19 |
select encrypt('', 'foo', 'cast5'); |
| 20 |
-- 10 bytes key |
| 21 |
select encrypt('foo', '0123456789', 'cast5'); |
| 22 |
|
| 23 |
-- decrypt |
| 24 |
select encode(decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5'), 'escape'); |
| 25 |
|
| 26 |
-- iv |
| 27 |
select encrypt_iv('foo', '0123456', 'abcd', 'cast5'); |
| 28 |
select encode(decrypt_iv('\x384a970695ce016a', '0123456', 'abcd', 'cast5'), 'escape'); |
| 29 |
|
| 30 |
-- long message |
| 31 |
select encrypt('Lets try a longer message.', '0123456789', 'cast5'); |
| 32 |
select encode(decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5'), 'escape'); |