]> git.sesse.net Git - shamaz/commitdiff
Add missing file encrypt-ice.c.
authorsgunderson@bigfoot.com <>
Sun, 21 Feb 2010 01:33:43 +0000 (02:33 +0100)
committersgunderson@bigfoot.com <>
Sun, 21 Feb 2010 01:33:43 +0000 (02:33 +0100)
encrypt-ice.c [new file with mode: 0644]

diff --git a/encrypt-ice.c b/encrypt-ice.c
new file mode 100644 (file)
index 0000000..bf5c53b
--- /dev/null
@@ -0,0 +1,25 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "ice.h"
+
+unsigned char keymat[] = { 0x5C, 0x09, 0xD8, 0x3A, 0x2A, 0x3A, 0x47, 0x8A };
+
+int main(int argc, char **argv)
+{
+       unsigned char in[8], out[8];
+       ICE_KEY *key = ice_key_create(1);
+       ice_key_set(key, keymat);
+
+       for ( ;; ) {
+               int ret = fread(in, 1, 8, stdin);
+               if (ret == 0) {
+                       exit(0);
+               }
+               if (ret < 8) {
+                       memset(in + ret, 0, (8 - ret));
+               }
+               ice_key_encrypt(key, in, out);
+               fwrite(out, 8, 1, stdout);
+       }
+}