shithub: riscv

ref: 65ef69a85d1c0f4694a361f5a0a99bdbb4f2cd95
dir: /sys/src/libc/port/netcrypt.c/

View raw version
#include <u.h>
#include <libc.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;
}