summaryrefslogtreecommitdiffstats
path: root/contrib/pgcrypto/expected/3des.out
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/pgcrypto/expected/3des.out')
-rw-r--r--contrib/pgcrypto/expected/3des.out71
1 files changed, 71 insertions, 0 deletions
diff --git a/contrib/pgcrypto/expected/3des.out b/contrib/pgcrypto/expected/3des.out
new file mode 100644
index 0000000..8983a73
--- /dev/null
+++ b/contrib/pgcrypto/expected/3des.out
@@ -0,0 +1,71 @@
+--
+-- 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');
+ encode
+------------------
+ 95f8a5e5dd31d900
+(1 row)
+
+-- val 95 F8 A5 E5 DD 31 D9 00
+select encode( encrypt('', 'foo', '3des'), 'hex');
+ encode
+------------------
+ 752111e37a2d7ac3
+(1 row)
+
+-- 10 bytes key
+select encode( encrypt('foo', '0123456789', '3des'), 'hex');
+ encode
+------------------
+ d2fb8baa1717cb02
+(1 row)
+
+-- 22 bytes key
+select encode( encrypt('foo', '0123456789012345678901', '3des'), 'hex');
+ encode
+------------------
+ a44360e699269817
+(1 row)
+
+-- decrypt
+select decrypt(encrypt('foo', '0123456', '3des'), '0123456', '3des');
+ decrypt
+---------
+ foo
+(1 row)
+
+-- iv
+select encode(encrypt_iv('foo', '0123456', 'abcd', '3des'), 'hex');
+ encode
+------------------
+ 50735067b073bb93
+(1 row)
+
+select decrypt_iv(decode('50735067b073bb93', 'hex'), '0123456', 'abcd', '3des');
+ decrypt_iv
+------------
+ foo
+(1 row)
+
+-- long message
+select encode(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), 'hex');
+ encode
+------------------------------------------------------------------
+ b71e3422269d0ded19468f33d65cd663c28e0871984792a7b3ba0ddcecec8d2c
+(1 row)
+
+select decrypt(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), '0123456789012345678901', '3des');
+ decrypt
+----------------------------
+ Lets try a longer message.
+(1 row)
+