summaryrefslogtreecommitdiffstats
path: root/contrib/pgcrypto/expected/3des.out
blob: ee1548987781158e6a070bd81c7be6aceba5fb58 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
--
-- 3DES cipher
--
-- test vector from somewhere
SELECT encrypt('\x8000000000000000',
               '\x010101010101010101010101010101010101010101010101',
               '3des-ecb/pad:none');
      encrypt       
--------------------
 \x95f8a5e5dd31d900
(1 row)

select encrypt('', 'foo', '3des');
      encrypt       
--------------------
 \x752111e37a2d7ac3
(1 row)

-- 10 bytes key
select encrypt('foo', '0123456789', '3des');
      encrypt       
--------------------
 \xd2fb8baa1717cb02
(1 row)

-- 22 bytes key
select encrypt('foo', '0123456789012345678901', '3des');
      encrypt       
--------------------
 \xa44360e699269817
(1 row)

-- decrypt
select encode(decrypt(encrypt('foo', '0123456', '3des'), '0123456', '3des'), 'escape');
 encode 
--------
 foo
(1 row)

-- iv
select encrypt_iv('foo', '0123456', 'abcd', '3des');
     encrypt_iv     
--------------------
 \x50735067b073bb93
(1 row)

select encode(decrypt_iv('\x50735067b073bb93', '0123456', 'abcd', '3des'), 'escape');
 encode 
--------
 foo
(1 row)

-- long message
select encrypt('Lets try a longer message.', '0123456789012345678901', '3des');
                              encrypt                               
--------------------------------------------------------------------
 \xb71e3422269d0ded19468f33d65cd663c28e0871984792a7b3ba0ddcecec8d2c
(1 row)

select encode(decrypt(encrypt('Lets try a longer message.', '0123456789012345678901', '3des'), '0123456789012345678901', '3des'), 'escape');
           encode           
----------------------------
 Lets try a longer message.
(1 row)