Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
43cadb92
Commit
43cadb92
authored
Oct 01, 2001
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing pgcrypto files.
parent
998cebc4
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
837 additions
and
0 deletions
+837
-0
contrib/pgcrypto/expected/blowfish.out
contrib/pgcrypto/expected/blowfish.out
+108
-0
contrib/pgcrypto/expected/crypt-blowfish.out
contrib/pgcrypto/expected/crypt-blowfish.out
+26
-0
contrib/pgcrypto/expected/crypt-des.out
contrib/pgcrypto/expected/crypt-des.out
+26
-0
contrib/pgcrypto/expected/crypt-md5.out
contrib/pgcrypto/expected/crypt-md5.out
+26
-0
contrib/pgcrypto/expected/crypt-xdes.out
contrib/pgcrypto/expected/crypt-xdes.out
+26
-0
contrib/pgcrypto/expected/hmac-md5.out
contrib/pgcrypto/expected/hmac-md5.out
+72
-0
contrib/pgcrypto/expected/hmac-sha1.out
contrib/pgcrypto/expected/hmac-sha1.out
+72
-0
contrib/pgcrypto/expected/init.out
contrib/pgcrypto/expected/init.out
+17
-0
contrib/pgcrypto/expected/md5.out
contrib/pgcrypto/expected/md5.out
+45
-0
contrib/pgcrypto/expected/rijndael.out
contrib/pgcrypto/expected/rijndael.out
+69
-0
contrib/pgcrypto/expected/sha1.out
contrib/pgcrypto/expected/sha1.out
+45
-0
contrib/pgcrypto/sql/blowfish.sql
contrib/pgcrypto/sql/blowfish.sql
+66
-0
contrib/pgcrypto/sql/crypt-blowfish.sql
contrib/pgcrypto/sql/crypt-blowfish.sql
+17
-0
contrib/pgcrypto/sql/crypt-des.sql
contrib/pgcrypto/sql/crypt-des.sql
+17
-0
contrib/pgcrypto/sql/crypt-md5.sql
contrib/pgcrypto/sql/crypt-md5.sql
+17
-0
contrib/pgcrypto/sql/crypt-xdes.sql
contrib/pgcrypto/sql/crypt-xdes.sql
+17
-0
contrib/pgcrypto/sql/hmac-md5.sql
contrib/pgcrypto/sql/hmac-md5.sql
+46
-0
contrib/pgcrypto/sql/hmac-sha1.sql
contrib/pgcrypto/sql/hmac-sha1.sql
+46
-0
contrib/pgcrypto/sql/init.sql
contrib/pgcrypto/sql/init.sql
+12
-0
contrib/pgcrypto/sql/md5.sql
contrib/pgcrypto/sql/md5.sql
+12
-0
contrib/pgcrypto/sql/rijndael.sql
contrib/pgcrypto/sql/rijndael.sql
+43
-0
contrib/pgcrypto/sql/sha1.sql
contrib/pgcrypto/sql/sha1.sql
+12
-0
No files found.
contrib/pgcrypto/expected/blowfish.out
0 → 100644
View file @
43cadb92
--
-- Blowfish cipher
--
-- some standard Blowfish testvalues
select encode(encrypt(
decode('0000000000000000', 'hex'),
decode('0000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
encode
------------------
4ef997456198dd78
(1 row)
select encode(encrypt(
decode('ffffffffffffffff', 'hex'),
decode('ffffffffffffffff', 'hex'),
'bf-ecb/pad:none'), 'hex');
encode
------------------
51866fd5b85ecb8a
(1 row)
select encode(encrypt(
decode('1000000000000001', 'hex'),
decode('3000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
encode
------------------
7d856f9a613063f2
(1 row)
select encode(encrypt(
decode('1111111111111111', 'hex'),
decode('1111111111111111', 'hex'),
'bf-ecb/pad:none'), 'hex');
encode
------------------
2466dd878b963c9d
(1 row)
select encode(encrypt(
decode('0123456789abcdef', 'hex'),
decode('fedcba9876543210', 'hex'),
'bf-ecb/pad:none'), 'hex');
encode
------------------
0aceab0fc6a0a28d
(1 row)
select encode(encrypt(
decode('01a1d6d039776742', 'hex'),
decode('fedcba9876543210', 'hex'),
'bf-ecb/pad:none'), 'hex');
encode
------------------
3273b8badc9e9e15
(1 row)
select encode(encrypt(
decode('ffffffffffffffff', 'hex'),
decode('0000000000000000', 'hex'),
'bf-ecb/pad:none'), 'hex');
encode
------------------
014933e0cdaff6e4
(1 row)
-- setkey
select encode(encrypt(
decode('fedcba9876543210', 'hex'),
decode('f0e1d2c3b4a5968778695a4b3c2d1e0f', 'hex'),
'bf-ecb/pad:none'), 'hex');
encode
------------------
93142887ee3be15c
(1 row)
-- with padding
select encode(encrypt(
decode('01234567890123456789', 'hex'),
decode('33443344334433443344334433443344', 'hex'),
'bf-ecb'), 'hex');
encode
----------------------------------
0d04a43a20456dee5ede6ed9e4dcaaa6
(1 row)
-- cbc
-- 28 bytes key
select encode(encrypt(
decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5', 'hex'),
decode('37363534333231204e6f77206973207468652074696d6520666f7220', 'hex'),
'bf-cbc'), 'hex');
encode
------------------------------------------------------------------
4f2beb748c4f689ec755edb9dc252a41b93a3786850b4c75d6a702b6a8e48825
(1 row)
-- 29 bytes key
select encode(encrypt(
decode('6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc', 'hex'),
decode('37363534333231204e6f77206973207468652074696d6520666f722000', 'hex'),
'bf-cbc'), 'hex');
encode
----------------------------------------------------------------------------------
3ea6357a0ee7fad6d0c4b63464f2aafa40c2e91b4b7e1bba8114932fd92b5c8f111e7e50e7b2e541
(1 row)
contrib/pgcrypto/expected/crypt-blowfish.out
0 → 100644
View file @
43cadb92
--
-- crypt() and gen_salt(): bcrypt
--
select crypt('', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
crypt
--------------------------------------------------------------
$2a$06$RQiOJ.3ELirrXwxIZY8q0OlGbBEpDmx7IRZlNYvGJ1SHXwNi2cEKK
(1 row)
select crypt('foox', '$2a$06$RQiOJ.3ELirrXwxIZY8q0O');
crypt
--------------------------------------------------------------
$2a$06$RQiOJ.3ELirrXwxIZY8q0OR3CVJrAfda1z26CCHPnB6mmVZD8p0/C
(1 row)
create table ctest (data text, res text, salt text);
insert into ctest values ('password', '', '');
update ctest set salt = gen_salt('bf', 8);
update ctest set res = crypt(data, salt);
select res = crypt(data, res) as "worked" from ctest;
worked
--------
t
(1 row)
drop table ctest;
contrib/pgcrypto/expected/crypt-des.out
0 → 100644
View file @
43cadb92
--
-- crypt() and gen_salt(): crypt-des
--
select crypt('', 'NB');
crypt
---------------
NBPx/38Y48kHg
(1 row)
select crypt('foox', 'NB');
crypt
---------------
NB53EGGqrrb5E
(1 row)
create table ctest (data text, res text, salt text);
insert into ctest values ('password', '', '');
update ctest set salt = gen_salt('des');
update ctest set res = crypt(data, salt);
select res = crypt(data, res) as "worked" from ctest;
worked
--------
t
(1 row)
drop table ctest;
contrib/pgcrypto/expected/crypt-md5.out
0 → 100644
View file @
43cadb92
--
-- crypt() and gen_salt(): md5
--
select crypt('', '$1$Szzz0yzz');
crypt
------------------------------------
$1$Szzz0yzz$To38XrR3BsbXQW2ZpfKjF1
(1 row)
select crypt('foox', '$1$Szzz0yzz');
crypt
------------------------------------
$1$Szzz0yzz$IYL49cd3t9bllsA7Jmz1M1
(1 row)
create table ctest (data text, res text, salt text);
insert into ctest values ('password', '', '');
update ctest set salt = gen_salt('md5');
update ctest set res = crypt(data, salt);
select res = crypt(data, res) as "worked" from ctest;
worked
--------
t
(1 row)
drop table ctest;
contrib/pgcrypto/expected/crypt-xdes.out
0 → 100644
View file @
43cadb92
--
-- crypt() and gen_salt(): extended des
--
select crypt('', '_J9..j2zz');
crypt
----------------------
_J9..j2zzR/nIRDK3pPc
(1 row)
select crypt('foox', '_J9..j2zz');
crypt
----------------------
_J9..j2zzAYKMvO2BYRY
(1 row)
create table ctest (data text, res text, salt text);
insert into ctest values ('password', '', '');
update ctest set salt = gen_salt('xdes', 1001);
update ctest set res = crypt(data, salt);
select res = crypt(data, res) as "worked" from ctest;
worked
--------
t
(1 row)
drop table ctest;
contrib/pgcrypto/expected/hmac-md5.out
0 → 100644
View file @
43cadb92
--
-- HMAC-MD5
--
select encode(hmac(
'Hi There',
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
'md5'), 'hex');
encode
----------------------------------
9294727a3638bb1c13f48ef8158bfc9d
(1 row)
-- 2
select encode(hmac(
'Jefe',
'what do ya want for nothing?',
'md5'), 'hex');
encode
----------------------------------
813aead7c4a34bff01a16d61368e7c13
(1 row)
-- 3
select encode(hmac(
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
encode
----------------------------------
56be34521d144c88dbb8c733f0e8b3f6
(1 row)
-- 4
select encode(hmac(
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
'md5'), 'hex');
encode
----------------------------------
697eaf0aca3a3aea3a75164746ffaa79
(1 row)
-- 5
select encode(hmac(
'Test With Truncation',
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
'md5'), 'hex');
encode
----------------------------------
56461ef2342edc00f9bab995690efd4c
(1 row)
-- 6
select encode(hmac(
'Test Using Larger Than Block-Size Key - Hash Key First',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
encode
----------------------------------
6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd
(1 row)
-- 7
select encode(hmac(
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'md5'), 'hex');
encode
----------------------------------
6f630fad67cda0ee1fb1f562db3aa53e
(1 row)
contrib/pgcrypto/expected/hmac-sha1.out
0 → 100644
View file @
43cadb92
--
-- HMAC-MD5
--
select encode(hmac(
'Hi There',
decode('0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b', 'hex'),
'sha1'), 'hex');
encode
------------------------------------------
675b0b3a1b4ddf4e124872da6c2f632bfed957e9
(1 row)
-- 2
select encode(hmac(
'Jefe',
'what do ya want for nothing?',
'sha1'), 'hex');
encode
------------------------------------------
156d4c35468a0339f3fa57a067bf47f814eb7a57
(1 row)
-- 3
select encode(hmac(
decode('dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd', 'hex'),
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
encode
------------------------------------------
d730594d167e35d5956fd8003d0db3d3f46dc7bb
(1 row)
-- 4
select encode(hmac(
decode('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'),
decode('0102030405060708090a0b0c0d0e0f10111213141516171819', 'hex'),
'sha1'), 'hex');
encode
------------------------------------------
4c9007f4026250c6bc8414f9bf50c86c2d7235da
(1 row)
-- 5
select encode(hmac(
'Test With Truncation',
decode('0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c', 'hex'),
'sha1'), 'hex');
encode
------------------------------------------
37268b7e21e84da5720c53c4ba03ad1104039fa7
(1 row)
-- 6
select encode(hmac(
'Test Using Larger Than Block-Size Key - Hash Key First',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
encode
------------------------------------------
aa4ae5e15272d00e95705637ce8a3b55ed402112
(1 row)
-- 7
select encode(hmac(
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data',
decode('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'),
'sha1'), 'hex');
encode
------------------------------------------
e8e99d0f45237d786d6bbaa7965c7808bbff1a91
(1 row)
contrib/pgcrypto/expected/init.out
0 → 100644
View file @
43cadb92
--
-- init pgcrypto
--
\set ECHO none
-- check for encoding fn's
select encode('foo', 'hex');
encode
--------
666f6f
(1 row)
select decode('666f6f', 'hex');
decode
--------
foo
(1 row)
contrib/pgcrypto/expected/md5.out
0 → 100644
View file @
43cadb92
--
-- MD5 message digest
--
select encode(digest('', 'md5'), 'hex');
encode
----------------------------------
d41d8cd98f00b204e9800998ecf8427e
(1 row)
select encode(digest('a', 'md5'), 'hex');
encode
----------------------------------
0cc175b9c0f1b6a831c399e269772661
(1 row)
select encode(digest('abc', 'md5'), 'hex');
encode
----------------------------------
900150983cd24fb0d6963f7d28e17f72
(1 row)
select encode(digest('message digest', 'md5'), 'hex');
encode
----------------------------------
f96b697d7cb7938d525a2f31aaf161d0
(1 row)
select encode(digest('abcdefghijklmnopqrstuvwxyz', 'md5'), 'hex');
encode
----------------------------------
c3fcd3d76192e4007dfb496cca67e13b
(1 row)
select encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'md5'), 'hex');
encode
----------------------------------
d174ab98d277d9f5a5611c2c9f419d9f
(1 row)
select encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'md5'), 'hex');
encode
----------------------------------
57edf4a22be3c955ac49da2e2107b67a
(1 row)
contrib/pgcrypto/expected/rijndael.out
0 → 100644
View file @
43cadb92
--
-- AES / Rijndael-128 cipher
--
-- some standard Rijndael testvalues
select encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f', 'hex'),
'aes-ecb/pad:none'), 'hex');
encode
----------------------------------
69c4e0d86a7b0430d8cdb78070b4c55a
(1 row)
select encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f1011121314151617', 'hex'),
'aes-ecb/pad:none'), 'hex');
encode
----------------------------------
dda97ca4864cdfe06eaf70a0ec0d7191
(1 row)
select encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'),
'aes-ecb/pad:none'), 'hex');
encode
----------------------------------
8ea2b7ca516745bfeafc49904b496089
(1 row)
-- cbc
select encode(encrypt(
decode('00112233445566778899aabbccddeeff', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f', 'hex'),
'aes-cbc/pad:none'), 'hex');
encode
----------------------------------
8ea2b7ca516745bfeafc49904b496089
(1 row)
-- key padding
select encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405', 'hex'),
'aes-cbc'), 'hex');
encode
----------------------------------
189a28932213f017b246678dbc28655f
(1 row)
select encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405060708090a0b0c0d0e0f10111213', 'hex'),
'aes-cbc'), 'hex');
encode
----------------------------------
3b02279162d15580e069d3a71407a556
(1 row)
select encode(encrypt(
decode('0011223344', 'hex'),
decode('000102030405060708090a0b0c0d0e0f101112131415161718191a1b', 'hex'),
'aes-cbc'), 'hex');
encode
----------------------------------
4facb6a041d53e0a5a73289170901fe7
(1 row)
contrib/pgcrypto/expected/sha1.out
0 → 100644
View file @
43cadb92
--
-- SHA1 message digest
--
select encode(digest('', 'sha1'), 'hex');
encode
------------------------------------------
da39a3ee5e6b4b0d3255bfef95601890afd80709
(1 row)
select encode(digest('a', 'sha1'), 'hex');
encode
------------------------------------------
86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
(1 row)
select encode(digest('abc', 'sha1'), 'hex');
encode
------------------------------------------
a9993e364706816aba3e25717850c26c9cd0d89d
(1 row)
select encode(digest('message digest', 'sha1'), 'hex');
encode
------------------------------------------
c12252ceda8be8994d5fa0290a47231c1d16aae3
(1 row)
select encode(digest('abcdefghijklmnopqrstuvwxyz', 'sha1'), 'hex');
encode
------------------------------------------
32d10c7b8cf96570ca04ce37f2a19d84240d3a89
(1 row)
select encode(digest('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789', 'sha1'), 'hex');
encode
------------------------------------------
761c457bf73b14d27e9e9265c46f4b4dda11f940
(1 row)
select encode(digest('12345678901234567890123456789012345678901234567890123456789012345678901234567890', 'sha1'), 'hex');
encode
------------------------------------------
50abf5706a150990a08b2c5ea40fa0e585554732
(1 row)
contrib/pgcrypto/sql/blowfish.sql
0 → 100644
View file @
43cadb92
--
-- Blowfish cipher
--
-- some standard Blowfish testvalues
select
encode
(
encrypt
(
decode
(
'0000000000000000'
,
'hex'
),
decode
(
'0000000000000000'
,
'hex'
),
'bf-ecb/pad:none'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'ffffffffffffffff'
,
'hex'
),
decode
(
'ffffffffffffffff'
,
'hex'
),
'bf-ecb/pad:none'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'1000000000000001'
,
'hex'
),
decode
(
'3000000000000000'
,
'hex'
),
'bf-ecb/pad:none'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'1111111111111111'
,
'hex'
),
decode
(
'1111111111111111'
,
'hex'
),
'bf-ecb/pad:none'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'0123456789abcdef'
,
'hex'
),
decode
(
'fedcba9876543210'
,
'hex'
),
'bf-ecb/pad:none'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'01a1d6d039776742'
,
'hex'
),
decode
(
'fedcba9876543210'
,
'hex'
),
'bf-ecb/pad:none'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'ffffffffffffffff'
,
'hex'
),
decode
(
'0000000000000000'
,
'hex'
),
'bf-ecb/pad:none'
),
'hex'
);
-- setkey
select
encode
(
encrypt
(
decode
(
'fedcba9876543210'
,
'hex'
),
decode
(
'f0e1d2c3b4a5968778695a4b3c2d1e0f'
,
'hex'
),
'bf-ecb/pad:none'
),
'hex'
);
-- with padding
select
encode
(
encrypt
(
decode
(
'01234567890123456789'
,
'hex'
),
decode
(
'33443344334433443344334433443344'
,
'hex'
),
'bf-ecb'
),
'hex'
);
-- cbc
-- 28 bytes key
select
encode
(
encrypt
(
decode
(
'6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5'
,
'hex'
),
decode
(
'37363534333231204e6f77206973207468652074696d6520666f7220'
,
'hex'
),
'bf-cbc'
),
'hex'
);
-- 29 bytes key
select
encode
(
encrypt
(
decode
(
'6b77b4d63006dee605b156e27403979358deb9e7154616d959f1652bd5ff92cc'
,
'hex'
),
decode
(
'37363534333231204e6f77206973207468652074696d6520666f722000'
,
'hex'
),
'bf-cbc'
),
'hex'
);
contrib/pgcrypto/sql/crypt-blowfish.sql
0 → 100644
View file @
43cadb92
--
-- crypt() and gen_salt(): bcrypt
--
select
crypt
(
''
,
'$2a$06$RQiOJ.3ELirrXwxIZY8q0O'
);
select
crypt
(
'foox'
,
'$2a$06$RQiOJ.3ELirrXwxIZY8q0O'
);
create
table
ctest
(
data
text
,
res
text
,
salt
text
);
insert
into
ctest
values
(
'password'
,
''
,
''
);
update
ctest
set
salt
=
gen_salt
(
'bf'
,
8
);
update
ctest
set
res
=
crypt
(
data
,
salt
);
select
res
=
crypt
(
data
,
res
)
as
"worked"
from
ctest
;
drop
table
ctest
;
contrib/pgcrypto/sql/crypt-des.sql
0 → 100644
View file @
43cadb92
--
-- crypt() and gen_salt(): crypt-des
--
select
crypt
(
''
,
'NB'
);
select
crypt
(
'foox'
,
'NB'
);
create
table
ctest
(
data
text
,
res
text
,
salt
text
);
insert
into
ctest
values
(
'password'
,
''
,
''
);
update
ctest
set
salt
=
gen_salt
(
'des'
);
update
ctest
set
res
=
crypt
(
data
,
salt
);
select
res
=
crypt
(
data
,
res
)
as
"worked"
from
ctest
;
drop
table
ctest
;
contrib/pgcrypto/sql/crypt-md5.sql
0 → 100644
View file @
43cadb92
--
-- crypt() and gen_salt(): md5
--
select
crypt
(
''
,
'$1$Szzz0yzz'
);
select
crypt
(
'foox'
,
'$1$Szzz0yzz'
);
create
table
ctest
(
data
text
,
res
text
,
salt
text
);
insert
into
ctest
values
(
'password'
,
''
,
''
);
update
ctest
set
salt
=
gen_salt
(
'md5'
);
update
ctest
set
res
=
crypt
(
data
,
salt
);
select
res
=
crypt
(
data
,
res
)
as
"worked"
from
ctest
;
drop
table
ctest
;
contrib/pgcrypto/sql/crypt-xdes.sql
0 → 100644
View file @
43cadb92
--
-- crypt() and gen_salt(): extended des
--
select
crypt
(
''
,
'_J9..j2zz'
);
select
crypt
(
'foox'
,
'_J9..j2zz'
);
create
table
ctest
(
data
text
,
res
text
,
salt
text
);
insert
into
ctest
values
(
'password'
,
''
,
''
);
update
ctest
set
salt
=
gen_salt
(
'xdes'
,
1001
);
update
ctest
set
res
=
crypt
(
data
,
salt
);
select
res
=
crypt
(
data
,
res
)
as
"worked"
from
ctest
;
drop
table
ctest
;
contrib/pgcrypto/sql/hmac-md5.sql
0 → 100644
View file @
43cadb92
--
-- HMAC-MD5
--
select
encode
(
hmac
(
'Hi There'
,
decode
(
'0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'
,
'hex'
),
'md5'
),
'hex'
);
-- 2
select
encode
(
hmac
(
'Jefe'
,
'what do ya want for nothing?'
,
'md5'
),
'hex'
);
-- 3
select
encode
(
hmac
(
decode
(
'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'
,
'hex'
),
decode
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
'hex'
),
'md5'
),
'hex'
);
-- 4
select
encode
(
hmac
(
decode
(
'cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd'
,
'hex'
),
decode
(
'0102030405060708090a0b0c0d0e0f10111213141516171819'
,
'hex'
),
'md5'
),
'hex'
);
-- 5
select
encode
(
hmac
(
'Test With Truncation'
,
decode
(
'0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c'
,
'hex'
),
'md5'
),
'hex'
);
-- 6
select
encode
(
hmac
(
'Test Using Larger Than Block-Size Key - Hash Key First'
,
decode
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
'hex'
),
'md5'
),
'hex'
);
-- 7
select
encode
(
hmac
(
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data'
,
decode
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
'hex'
),
'md5'
),
'hex'
);
contrib/pgcrypto/sql/hmac-sha1.sql
0 → 100644
View file @
43cadb92
--
-- HMAC-MD5
--
select
encode
(
hmac
(
'Hi There'
,
decode
(
'0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b'
,
'hex'
),
'sha1'
),
'hex'
);
-- 2
select
encode
(
hmac
(
'Jefe'
,
'what do ya want for nothing?'
,
'sha1'
),
'hex'
);
-- 3
select
encode
(
hmac
(
decode
(
'dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd'
,
'hex'
),
decode
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
'hex'
),
'sha1'
),
'hex'
);
-- 4
select
encode
(
hmac
(
decode
(
'cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd'
,
'hex'
),
decode
(
'0102030405060708090a0b0c0d0e0f10111213141516171819'
,
'hex'
),
'sha1'
),
'hex'
);
-- 5
select
encode
(
hmac
(
'Test With Truncation'
,
decode
(
'0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c0c'
,
'hex'
),
'sha1'
),
'hex'
);
-- 6
select
encode
(
hmac
(
'Test Using Larger Than Block-Size Key - Hash Key First'
,
decode
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
'hex'
),
'sha1'
),
'hex'
);
-- 7
select
encode
(
hmac
(
'Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data'
,
decode
(
'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
,
'hex'
),
'sha1'
),
'hex'
);
contrib/pgcrypto/sql/init.sql
0 → 100644
View file @
43cadb92
--
-- init pgcrypto
--
\
set
ECHO
none
\
i
pgcrypto
.
sql
\
set
ECHO
all
-- check for encoding fn's
select
encode
(
'foo'
,
'hex'
);
select
decode
(
'666f6f'
,
'hex'
);
contrib/pgcrypto/sql/md5.sql
0 → 100644
View file @
43cadb92
--
-- MD5 message digest
--
select
encode
(
digest
(
''
,
'md5'
),
'hex'
);
select
encode
(
digest
(
'a'
,
'md5'
),
'hex'
);
select
encode
(
digest
(
'abc'
,
'md5'
),
'hex'
);
select
encode
(
digest
(
'message digest'
,
'md5'
),
'hex'
);
select
encode
(
digest
(
'abcdefghijklmnopqrstuvwxyz'
,
'md5'
),
'hex'
);
select
encode
(
digest
(
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
,
'md5'
),
'hex'
);
select
encode
(
digest
(
'12345678901234567890123456789012345678901234567890123456789012345678901234567890'
,
'md5'
),
'hex'
);
contrib/pgcrypto/sql/rijndael.sql
0 → 100644
View file @
43cadb92
--
-- AES / Rijndael-128 cipher
--
-- some standard Rijndael testvalues
select
encode
(
encrypt
(
decode
(
'00112233445566778899aabbccddeeff'
,
'hex'
),
decode
(
'000102030405060708090a0b0c0d0e0f'
,
'hex'
),
'aes-ecb/pad:none'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'00112233445566778899aabbccddeeff'
,
'hex'
),
decode
(
'000102030405060708090a0b0c0d0e0f1011121314151617'
,
'hex'
),
'aes-ecb/pad:none'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'00112233445566778899aabbccddeeff'
,
'hex'
),
decode
(
'000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'
,
'hex'
),
'aes-ecb/pad:none'
),
'hex'
);
-- cbc
select
encode
(
encrypt
(
decode
(
'00112233445566778899aabbccddeeff'
,
'hex'
),
decode
(
'000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f'
,
'hex'
),
'aes-cbc/pad:none'
),
'hex'
);
-- key padding
select
encode
(
encrypt
(
decode
(
'0011223344'
,
'hex'
),
decode
(
'000102030405'
,
'hex'
),
'aes-cbc'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'0011223344'
,
'hex'
),
decode
(
'000102030405060708090a0b0c0d0e0f10111213'
,
'hex'
),
'aes-cbc'
),
'hex'
);
select
encode
(
encrypt
(
decode
(
'0011223344'
,
'hex'
),
decode
(
'000102030405060708090a0b0c0d0e0f101112131415161718191a1b'
,
'hex'
),
'aes-cbc'
),
'hex'
);
contrib/pgcrypto/sql/sha1.sql
0 → 100644
View file @
43cadb92
--
-- SHA1 message digest
--
select
encode
(
digest
(
''
,
'sha1'
),
'hex'
);
select
encode
(
digest
(
'a'
,
'sha1'
),
'hex'
);
select
encode
(
digest
(
'abc'
,
'sha1'
),
'hex'
);
select
encode
(
digest
(
'message digest'
,
'sha1'
),
'hex'
);
select
encode
(
digest
(
'abcdefghijklmnopqrstuvwxyz'
,
'sha1'
),
'hex'
);
select
encode
(
digest
(
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
,
'sha1'
),
'hex'
);
select
encode
(
digest
(
'12345678901234567890123456789012345678901234567890123456789012345678901234567890'
,
'sha1'
),
'hex'
);
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment