From 220ea192c8429c38148687be7df36d674391c843 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?=
 <grubba@grubba.org>
Date: Sun, 22 May 2005 13:57:26 +0200
Subject: [PATCH] Improved Crypto compat with Pike 7.4.

Rev: lib/7.4/modules/Crypto.pmod/module.pmod:1.15
Rev: lib/7.4/modules/_Crypto.pmod:1.1
---
 .gitattributes                          |  1 +
 lib/7.4/modules/Crypto.pmod/module.pmod |  8 +++----
 lib/7.4/modules/_Crypto.pmod            | 32 +++++++++++++++++++++++++
 3 files changed, 37 insertions(+), 4 deletions(-)
 create mode 100644 lib/7.4/modules/_Crypto.pmod

diff --git a/.gitattributes b/.gitattributes
index 2b488fc65e..4da1c5a8d5 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -64,6 +64,7 @@ testfont binary
 /lib/7.4/modules/SSL.pmod/sslfile.pike foreign_ident
 /lib/7.4/modules/Stdio.pmod/module.pmod foreign_ident
 /lib/7.4/modules/Tools.pmod/Standalone.pmod/extract_autodoc.pike foreign_ident
+/lib/7.4/modules/_Crypto.pmod foreign_ident
 /lib/7.4/modules/__default.pmod foreign_ident
 /lib/7.6/modules/Debug.pmod/module.pmod foreign_ident
 /lib/7.6/modules/Protocols.pmod/LDAP.pmod/client.pike foreign_ident
diff --git a/lib/7.4/modules/Crypto.pmod/module.pmod b/lib/7.4/modules/Crypto.pmod/module.pmod
index 6e1ca54191..507f2467e0 100644
--- a/lib/7.4/modules/Crypto.pmod/module.pmod
+++ b/lib/7.4/modules/Crypto.pmod/module.pmod
@@ -1,8 +1,8 @@
 #pike 7.6
 
-#if constant(Crypto.crypt_md5)
-//! From Pike 7.5 @[pw] and @[salt] are binary strings, so
-//! the result is different if any of these includes @expr{"\0"@}.
+#if constant(Nettle.crypt_md5)
+//! From Pike 7.5 an in Nettle @[pw] and @[salt] are binary strings, so
+//! the result is different if any of these contains @expr{"\0"@}.
 //!
 //! The return type is also changed from string to int|string. If
 //! the second argument is a hash, @[pw] will be hashed with the
@@ -13,7 +13,7 @@ string crypt_md5(string pw, void|string salt) {
     sscanf(salt, "%s\0", salt);
     sscanf(salt, "$1$%s", salt);
   }
-  return Crypto.crypt_md5(pw,salt);
+  return Nettle.crypt_md5(pw,salt);
 }
 #endif
 
diff --git a/lib/7.4/modules/_Crypto.pmod b/lib/7.4/modules/_Crypto.pmod
new file mode 100644
index 0000000000..9dd796c93d
--- /dev/null
+++ b/lib/7.4/modules/_Crypto.pmod
@@ -0,0 +1,32 @@
+/*
+ * $Id: _Crypto.pmod,v 1.1 2005/05/22 11:57:26 grubba Exp $
+ *
+ * Compat for _Crypto.
+ *
+ * 2005-05-22 Henrik Grubbstr�m
+ */
+
+/* Note: We base this module on Crypto, which is the reverse of
+ *       the way a true Pike 7.4 did.
+ */
+#pike 7.4
+#if constant(Crypto)
+
+constant cast = Crypto.cast;
+constant pipe = Crypto.pipe;
+constant invert = Crypto.invert;
+constant arcfour = Crypto.arcfour;
+constant des = Crypto.des;
+constant cbc = Crypto.cbc;
+constant crypto = Crypto.crypto;
+constant sha = Crypto.sha;
+constant md4 = Crypto.md4;
+constant md5 = Crypto.md5;
+constant crypt_md5 = Crypto.crypt_md5;
+constant string_to_hex = Crypto.string_to_hex;
+constant des_parity = Crypto.des_parity;
+constant hex_to_string = Crypto.hex_to_string;
+constant md2 = Crypto.md2;
+constant rijndael = Crypto.rijndael;
+
+#endif /* constant(Crypto) */
\ No newline at end of file
-- 
GitLab