File: utilBase64.c

package info (click to toggle)
ted 2.11-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 11,064 kB
  • ctags: 13,935
  • sloc: ansic: 120,446; makefile: 7,469; sh: 253
file content (31 lines) | stat: -rw-r--r-- 789 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/************************************************************************/
/*									*/
/*  Utilities to translate back and forth between binary and base64	*/
/*									*/
/************************************************************************/

#   include	"utilBase64.h"

const unsigned char	UTIL_Base64Digits[]=
				       "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
				       "abcdefghijklmnopqrstuvwxyz"
				       "0123456789+/";

const int *	utilBase64GetIndexArray( void )
    {
    static int UTIL_Base64IndexArray[256];

    if  ( UTIL_Base64IndexArray[0] == 0 )
	{
	int	i;

	for ( i= 0; i < 256; i++ )
	    { UTIL_Base64IndexArray[i]= 0xff;	}

	i= 0;
	while( UTIL_Base64Digits[i] )
	    { UTIL_Base64IndexArray[UTIL_Base64Digits[i]]= i; i++;	}
	}

    return UTIL_Base64IndexArray;
    }