aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/netcrypt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib9/netcrypt.c')
-rw-r--r--src/lib9/netcrypt.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib9/netcrypt.c b/src/lib9/netcrypt.c
new file mode 100644
index 00000000..08fa6761
--- /dev/null
+++ b/src/lib9/netcrypt.c
@@ -0,0 +1,18 @@
+#include <u.h>
+#include <libc.h>
+#include <auth.h>
+
+int
+netcrypt(void *key, void *chal)
+{
+ uchar buf[8], *p;
+
+ strncpy((char*)buf, chal, 7);
+ buf[7] = '\0';
+ for(p = buf; *p && *p != '\n'; p++)
+ ;
+ *p = '\0';
+ encrypt(key, buf, 8);
+ sprint(chal, "%.2ux%.2ux%.2ux%.2ux", buf[0], buf[1], buf[2], buf[3]);
+ return 1;
+}