From 311bcfc6b3acdd6fd152798c7f287ddf74fa2a98 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Tue, 16 Apr 2024 21:46:48 +0200
Subject: Adding upstream version 15.4.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 contrib/pgcrypto/sql/cast5.sql | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)
 create mode 100644 contrib/pgcrypto/sql/cast5.sql

(limited to 'contrib/pgcrypto/sql/cast5.sql')

diff --git a/contrib/pgcrypto/sql/cast5.sql b/contrib/pgcrypto/sql/cast5.sql
new file mode 100644
index 0000000..b3089b2
--- /dev/null
+++ b/contrib/pgcrypto/sql/cast5.sql
@@ -0,0 +1,32 @@
+--
+-- Cast5 cipher
+--
+
+-- test vectors from RFC2144
+
+-- 128 bit key
+SELECT encrypt('\x0123456789ABCDEF', '\x0123456712345678234567893456789A', 'cast5-ecb/pad:none');
+
+-- 80 bit key
+SELECT encrypt('\x0123456789ABCDEF', '\x01234567123456782345', 'cast5-ecb/pad:none');
+
+-- 40 bit key
+SELECT encrypt('\x0123456789ABCDEF', '\x0123456712', 'cast5-ecb/pad:none');
+
+-- cbc
+
+-- empty data
+select encrypt('', 'foo', 'cast5');
+-- 10 bytes key
+select encrypt('foo', '0123456789', 'cast5');
+
+-- decrypt
+select encode(decrypt(encrypt('foo', '0123456', 'cast5'), '0123456', 'cast5'), 'escape');
+
+-- iv
+select encrypt_iv('foo', '0123456', 'abcd', 'cast5');
+select encode(decrypt_iv('\x384a970695ce016a', '0123456', 'abcd', 'cast5'), 'escape');
+
+-- long message
+select encrypt('Lets try a longer message.', '0123456789', 'cast5');
+select encode(decrypt(encrypt('Lets try a longer message.', '0123456789', 'cast5'), '0123456789', 'cast5'), 'escape');
-- 
cgit v1.2.3

