~ubuntu-branches/ubuntu/hardy/postgresql-8.4/hardy-backports

« back to all changes in this revision

Viewing changes to contrib/pgcrypto/sql/des.sql

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-03-20 12:00:13 UTC
  • Revision ID: james.westby@ubuntu.com-20090320120013-hogj7egc5mjncc5g
Tags: upstream-8.4~0cvs20090328
ImportĀ upstreamĀ versionĀ 8.4~0cvs20090328

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--
 
2
-- DES cipher
 
3
--
 
4
 
 
5
-- no official test vectors atm
 
6
 
 
7
-- from blowfish.sql
 
8
SELECT encode(encrypt(
 
9
decode('0123456789abcdef', 'hex'),
 
10
decode('fedcba9876543210', 'hex'),
 
11
'des-ecb/pad:none'), 'hex');
 
12
 
 
13
-- empty data
 
14
select encode(  encrypt('', 'foo', 'des'), 'hex');
 
15
-- 8 bytes key
 
16
select encode(  encrypt('foo', '01234589', 'des'), 'hex');
 
17
 
 
18
-- decrypt
 
19
select decrypt(encrypt('foo', '0123456', 'des'), '0123456', 'des');
 
20
 
 
21
-- iv
 
22
select encode(encrypt_iv('foo', '0123456', 'abcd', 'des'), 'hex');
 
23
select decrypt_iv(decode('50735067b073bb93', 'hex'), '0123456', 'abcd', 'des');
 
24
 
 
25
-- long message
 
26
select encode(encrypt('Lets try a longer message.', '01234567', 'des'), 'hex');
 
27
select decrypt(encrypt('Lets try a longer message.', '01234567', 'des'), '01234567', 'des');
 
28