]>
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[]";
26 INLINE
long numerictolong(const char *numeric
, int numericlen
)
31 for (i
=0;i
<numericlen
;i
++) {
32 mynumeric
=(mynumeric
<< 6)+numerictab
[(int) *(numeric
++)];
38 char *longtonumeric(long param
, int len
)
40 static char mynum
[7]; /* Static buffers rock. Multi-thread at your peril */
43 /* To go with our marvellous static buffer we
44 * have this rather groovy length limit. */
47 for (i
=len
-1;i
>=0;i
--) {
48 mynum
[i
] = tokens
[(param
% 64)];
56 /* Slightly more sane version of the above */
58 char *longtonumeric2(long param
, int len
, char *mynum
)
62 for (i
=len
-1;i
>=0;i
--) {
63 mynum
[i
] = tokens
[(param
% 64)];