1 #include <u.h> 2 #include <libc.h> 3 #include <bio.h> 4 #include "authcmdlib.h" 5 6 /* 7 * print a key in des standard form 8 */ 9 int 10 keyfmt(Fmt *f) 11 { 12 uchar key[8]; 13 char buf[32]; 14 uchar *k; 15 int i; 16 17 k = va_arg(f->args, uchar*); 18 key[0] = 0; 19 for(i = 0; i < 7; i++){ 20 key[i] |= k[i] >> i; 21 key[i] &= ~1; 22 key[i+1] = k[i] << (7 - i); 23 } 24 key[7] &= ~1; 25 sprint(buf, "%.3uo %.3uo %.3uo %.3uo %.3uo %.3uo %.3uo %.3uo", 26 key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7]); 27 fmtstrcpy(f, buf); 28 return 0; 29 } 30