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 #include "LgiDefs.h"
00015 
00016 // These buffer length macros round up to the nearest block of
00017 // bytes. So take the value returned by the convert routine as
00018 // the actual value... but use these to allocate buffers.
00019 #define BufferLen_64ToBin(l)        ( ((l)*3)/4 )
00020 #define BufferLen_BinTo64(l)        ( ((((l)+2)/3)*4) )
00021 
00022 // Character Conversion Routines
00023 //
00024 // Format of Base64 char:
00025 // 7               0
00026 // |-|-|-|-|-|-|-|-|
00027 // |-U-|--- Data --|
00028 //
00029 // Data = Bits, 0-63
00030 // U    = Unused, must be 0
00031 //
00032 LgiFunc uchar Base64ToBin(char c);
00033 LgiFunc char BinToBase64(uchar c);
00034 
00035 // String Conversion Routines
00036 //
00037 // Arguments:
00038 //  Binary:     Pointer to binary buffer
00039 //  OutBuf:     Size of output buffer (in bytes)
00040 //  Base64:     Pointer to Base64 buffer
00041 //  InBuf:      Size of input buffer (in bytes)
00042 //
00043 // Returns:
00044 //  Number of bytes converted.
00045 //
00046 LgiFunc int ConvertBase64ToBinary(uchar *Binary, int OutBuf, char *Base64, int InBuf);
00047 LgiFunc int ConvertBinaryToBase64(char *Base64, int OutBuf, uchar *Binary, int InBuf);
00048 
00049 #endif

Generated on Tue May 2 10:24:41 2006 for Lgi by  doxygen 1.4.1