2 ** Copyright 2002 Double Precision, Inc.
3 ** See COPYING for distribution information.
15 #include "random128.h"
17 static const char rcsid
[]="$Id: random128binary.c,v 1.2 2004/10/21 00:10:50 mrsam Exp $";
19 static int nyb(char c
)
21 static const char xdigit
[]="0123456789ABCDEF";
23 const char *p
=strchr(xdigit
, c
);
30 void random128_binary(random128binbuf
*bytes
)
32 char randombuf
[ 128 / 8 * 2 + 1];
35 strcpy(randombuf
, random128());
37 for (i
=0; i
<128/8; i
++)
38 (*bytes
)[i
]=(nyb(randombuf
[i
*2]) << 4) | nyb(randombuf
[i
*2+1]);