commit 32179ab4e862ce42698b90fd77be6ee56a16ead0
parent 6f731cd3df2e80b3d193833e42e1551103c89bed
Author: Alexander Burger <abu@software-lab.de>
Date: Mon, 13 May 2013 14:37:05 +0200
pil32 assword encryption
Diffstat:
6 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/ersatz/picolisp.jar b/ersatz/picolisp.jar
Binary files differ.
diff --git a/lib/adm.l b/lib/adm.l
@@ -1,4 +1,4 @@
-# 25feb13abu
+# 13may13abu
# (c) Software Lab. Alexander Burger
# *Salt *Login *Users *Perms
@@ -23,9 +23,10 @@
(inc (& 63 (rd 1))) ) ) ) ) ) )
(de passwd (Str Salt)
- (if (and native *Salt)
- (native "libcrypt.so" "crypt" 'S Str (or Salt (salt)))
- Str ) )
+ (nond
+ (*Salt Str)
+ (native (ext:Crypt Str Salt))
+ (NIL (native "libcrypt.so" "crypt" 'S Str (or Salt (salt)))) ) )
(de auth (Nm Pw)
(with (db 'nm '+User Nm)
diff --git a/src/Makefile b/src/Makefile
@@ -1,4 +1,4 @@
-# 01apr13abu
+# 13may13abu
# 27feb08rdo
# (c) Software Lab. Alexander Burger
@@ -101,7 +101,7 @@ endif
$(lib)/ext$(dll): ext.o
- gcc -o $(lib)/ext$(dll) $(DYNAMIC-LIB-FLAGS) ext.o $(DLL-DEFS)
+ gcc -o $(lib)/ext$(dll) $(DYNAMIC-LIB-FLAGS) ext.o $(DLL-DEFS) -lcrypt
$(STRIP) $(lib)/ext$(dll)
$(lib)/ht$(dll): ht.o
diff --git a/src/ext.c b/src/ext.c
@@ -1,4 +1,4 @@
-/* 18may10abu
+/* 13may13abu
* (c) Software Lab. Alexander Burger
*/
@@ -214,3 +214,23 @@ any Base64(any x) {
Env.put(Chr64[(d & 15) << 2 | c >> 6]), Env.put(Chr64[c & 63]);
return T;
}
+
+/*** Password hashing ***/
+// (Ext:Crypt 'key 'salt) -> str
+any Crypt(any x) {
+ any y;
+
+ y = evSym(x = cdr(x));
+ {
+ char key[bufSize(y)];
+
+ bufString(y, key);
+ y = evSym(cdr(x));
+ {
+ char salt[bufSize(y)];
+
+ bufString(y, salt);
+ return mkStr(crypt(key, salt));
+ }
+ }
+}
diff --git a/src/vers.h b/src/vers.h
@@ -1 +1 @@
-static byte Version[4] = {3,1,2,7};
+static byte Version[4] = {3,1,2,8};
diff --git a/src64/version.l b/src64/version.l
@@ -1,6 +1,6 @@
-# 09may13abu
+# 13may13abu
# (c) Software Lab. Alexander Burger
-(de *Version 3 1 2 7)
+(de *Version 3 1 2 8)
# vi:et:ts=3:sw=3