summaryrefslogtreecommitdiffstats
path: root/src/lib9/netcrypt.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2005-02-11 16:58:23 +0000
committerrsc <devnull@localhost>2005-02-11 16:58:23 +0000
commitb589fce2fbf05ae18a6f015240f87ce2a163521f (patch)
tree872dbf6e2c6f7be43971b6097f8bb15379e1379e /src/lib9/netcrypt.c
parent26a5fd572556f6d875c18fff8e83ed5eed6cf8fa (diff)
downloadplan9port-b589fce2fbf05ae18a6f015240f87ce2a163521f.tar.gz
plan9port-b589fce2fbf05ae18a6f015240f87ce2a163521f.zip
hard code list of plan 9 services in case they are not in /etc/services
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;
+}