Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/cmd/auth/lib/keyfmt.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 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
	snprint(buf, sizeof buf,
26
		"%.3uo %.3uo %.3uo %.3uo %.3uo %.3uo %.3uo %.3uo",
27
		key[0], key[1], key[2], key[3], key[4], key[5], key[6], key[7]);
28
	fmtstrcpy(f, buf);
29
	return 0;
30
}