Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

Base64.h

00001 /*hdr
00002 **      FILE:           Base64.h
00003 **      AUTHOR:         Matthew Allen
00004 **      DATE:           1/6/98
00005 **      DESCRIPTION:    Base64 encoding/decoding
00006 **
00007 **      Copyright (C) 1998, Matthew Allen
00008 **              fret@memecode.com
00009 */
00010 
00011 #ifndef __BASE64_H_
00012 #define __BASE64_H_
00013 
00014 // These buffer length macros round up to the nearest block of
00015 // bytes. So take the value returned by the convert routine as
00016 // the actual value... but use these to allocate buffers.
00017 #define BufferLen_64ToBin(l)        ( ((l)*3)/4 )
00018 #define BufferLen_BinTo64(l)        ( ((((l)+2)/3)*4) )
00019 
00020 // Character Conversion Routines
00021 //
00022 // Format of Base64 char:
00023 // 7               0
00024 // |-|-|-|-|-|-|-|-|
00025 // |-U-|--- Data --|
00026 //
00027 // Data = Bits, 0-63
00028 // U    = Unused, must be 0
00029 //
00030 LgiFunc uchar Base64ToBin(char c);
00031 LgiFunc char BinToBase64(uchar c);
00032 
00033 // String Conversion Routines
00034 //
00035 // Arguments:
00036 //  Binary:     Pointer to binary buffer
00037 //  OutBuf:     Size of output buffer (in bytes)
00038 //  Base64:     Pointer to Base64 buffer
00039 //  InBuf:      Size of input buffer (in bytes)
00040 //
00041 // Returns:
00042 //  Number of bytes converted.
00043 //
00044 LgiFunc int ConvertBase64ToBinary(uchar *Binary, int OutBuf, char *Base64, int InBuf);
00045 LgiFunc int ConvertBinaryToBase64(char *Base64, int OutBuf, uchar *Binary, int InBuf);
00046 
00047 #endif

Generated on Wed Oct 26 14:46:48 2005 for Lgi by  doxygen 1.4.1