2 * Copyright 2000, International Business Machines Corporation and others.
5 * This software has been released under the terms of the IBM Public
6 * License. For details, see the LICENSE file in the top-level source
7 * directory or online at http://www.openafs.org/dl/license10.html
10 #include <afs/param.h>
13 static char *c_xlate = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
17 * Create a base 32 string representation of a number.
18 * The supplied string 's' must be at least 8 bytes long.
19 * Use the b32_string_t tyepdef.
21 char *int_to_base32(b32_string_t s, int a)
41 break; /* found highest bits set. */
43 s[i++] = c_xlate[n>>j];
50 s[i++] = c_xlate[n>>j];
58 int base32_to_int(char *s)
68 n = 10 + (int)(*s - 'A');
70 result = (result << 5) + n;