]>
jfr.im git - irc/quakenet/newserv.git/blob - lib/base64.c
2 * base64.c: base64 functions
9 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
10 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
11 0, 0, 0, 0, 0, 0, 0, 0, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0,
12 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
13 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 62, 0, 63, 0, 0, 0, 26, 27, 28,
14 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
15 49, 50, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
16 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
17 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
18 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
19 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
20 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
21 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
24 char tokens
[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789[]";
27 VALID_INLINE long numerictolong(const char *numeric, int numericlen)
32 for (i=0;i<numericlen;i++) {
33 mynumeric=(mynumeric << 6)+numerictab[(int) *(numeric++)];
40 char *longtonumeric(long param
, int len
)
42 static char mynum
[7]; /* Static buffers rock. Multi-thread at your peril */
45 /* To go with our marvellous static buffer we
46 * have this rather groovy length limit. */
49 for (i
=len
-1;i
>=0;i
--) {
50 mynum
[i
] = tokens
[(param
% 64)];
58 /* Slightly more sane version of the above */
60 char *longtonumeric2(long param
, int len
, char *mynum
)
64 for (i
=len
-1;i
>=0;i
--) {
65 mynum
[i
] = tokens
[(param
% 64)];