1-- 2-- Cast5 cipher 3-- 4-- ensure consistent test output regardless of the default bytea format 5SET bytea_output TO escape; 6-- test vectors from RFC2144 7-- 128 bit key 8SELECT encode(encrypt( 9decode('01 23 45 67 89 AB CD EF', 'hex'), 10decode('01 23 45 67 12 34 56 78 23 45 67 89 34 56 78 9A', 'hex'), 11'cast5-ecb/pad:none'), 'hex'); 12ERROR: encrypt error: Cipher cannot be initialized ? 13-- result: 23 8B 4F E5 84 7E 44 B2 14-- 80 bit key 15SELECT encode(encrypt( 16decode('01 23 45 67 89 AB CD EF', 'hex'), 17decode('01 23 45 67 12 34 56 78 23 45', 'hex'), 18'cast5-ecb/pad:none'), 'hex'); 19ERROR: encrypt error: Cipher cannot be initialized ? 20-- result: EB 6A 71 1A 2C 02 27 1B 21-- 40 bit key 22SELECT encode(encrypt( 23decode('01 23 45 67 89 AB CD EF', 'hex'), 24decode('01 23 45 67 12', 'hex'), 25'cast5-ecb/pad:none'), 'hex'); 26ERROR: encrypt error: Cipher cannot be initialized ? 27-- result: 7A C8 16 D1 6E 9B 30 2E 28-- cbc 29-- empty data 30select encode( encrypt('', 'foo', 'cast5'), 'hex'); 31ERROR: encrypt error: Cipher cannot be initialized ? 32-- 10 bytes key 33select encode( encrypt('foo', '0123456789', 'cast5'), 'hex'); 34ERROR: encrypt error: Cipher cannot be initialized ? 35-- decrypt 36select decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5'); 37ERROR: encrypt error: Cipher cannot be initialized ? 38-- iv 39select encode(encrypt_iv('foo', '0123456', 'abcd', 'cast5'), 'hex'); 40ERROR: encrypt_iv error: Cipher cannot be initialized ? 41select decrypt_iv(decode('384a970695ce016a', 'hex'), 42 '0123456', 'abcd', 'cast5'); 43ERROR: decrypt_iv error: Cipher cannot be initialized ? 44-- long message 45select encode(encrypt('Lets try a longer message.', '0123456789', 'cast5'), 'hex'); 46ERROR: encrypt error: Cipher cannot be initialized ? 47select decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5'); 48ERROR: encrypt error: Cipher cannot be initialized ? 49