From: sgunderson@bigfoot.com <> Date: Sun, 21 Feb 2010 01:33:43 +0000 (+0100) Subject: Add missing file encrypt-ice.c. X-Git-Url: https://git.sesse.net/?p=shamaz;a=commitdiff_plain;h=19305235c7f929b4b0b1b1b3d724ae9216abeff1 Add missing file encrypt-ice.c. --- diff --git a/encrypt-ice.c b/encrypt-ice.c new file mode 100644 index 0000000..bf5c53b --- /dev/null +++ b/encrypt-ice.c @@ -0,0 +1,25 @@ +#include +#include +#include +#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); + } +}