1 1.1 sjg #include <sys/cdefs.h> 2 1.1 sjg #if !defined(lint) 3 1.1 sjg __RCSID("$NetBSD: util.c,v 1.1 2004/07/02 00:05:23 sjg Exp $"); 4 1.1 sjg #endif /* not lint */ 5 1.1 sjg 6 1.1 sjg #include <sys/types.h> 7 1.1 sjg 8 1.1 sjg #include "crypt.h" 9 1.1 sjg 10 1.1 sjg static const unsigned char itoa64[] = /* 0 ... 63 => ascii - 64 */ 11 1.1 sjg "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; 12 1.1 sjg 13 1.1 sjg void 14 1.1 sjg __crypt_to64(char *s, u_int32_t v, int n) 15 1.1 sjg { 16 1.1 sjg 17 1.1 sjg while (--n >= 0) { 18 1.1 sjg *s++ = itoa64[v & 0x3f]; 19 1.1 sjg v >>= 6; 20 1.1 sjg } 21 1.1 sjg } 22