ucharn_fmt.c (291B)
1 /* ISC license. */ 2 3 #include <skalibs/fmtscan.h> 4 5 size_t ucharn_fmt (char *s, char const *key, size_t n) 6 { 7 size_t i = 0 ; 8 for (; i < n ; i++) 9 { 10 s[i<<1] = fmtscan_asc((unsigned char)key[i] >> 4) ; 11 s[(i<<1)+1] = fmtscan_asc((unsigned char)key[i] & 0xF) ; 12 } 13 return n << 1 ; 14 }