La libreria FoxCrypto.fll usad en fox contiene la función que codifica y decodifica en base 64., el cual permite el trabajo tipo de datos bytes.
FUNCTION decodifica
PARAMETER pCadena
LOCAL lcBinary, lnHandle, lnSize
lnHandle = Base64DecoderCreate()
IF lnHandle > 0
Base64DecoderPut(lnHandle, pCadena)
Base64DecoderClose(lnHandle)
lnSize = Base64DecoderMaxRetrievable(lnHandle)
lcBinary = Base64DecoderGet(lnHandle, lnSize)
Base64DecoderDestroy(lnHandle)
ELSE
WAIT WIND "ERROR al instanciar"
RETURN .F.
ENDIF
RETURN lcBinary
FUNCTION codifica
PARAMETER pCadena
LOCAL lcBase64, lcInFile, lnHandle, lnSize
lnHandle = Base64EncoderCreate( .T. )
IF lnHandle > 0
Base64EncoderPut(lnHandle, pCadena)
Base64EncoderClose(lnHandle)
lnSize = Base64EncoderMaxRetrievable(lnHandle)
lcBase64 = Base64EncoderGet(lnHandle, lnSize)
Base64EncoderDestroy(lnHandle)
ELSE
WAIT WIND "ERROR al instanciar"
RETURN .F.
ENDIF
RETURN lcBase64
bucsando en internet encontre lo q parece el codigo fuente de esta libreria parece q esta en c++
http://www.cryptopp.com/#download
baJando veo q esta libreria que no se que diferencia hay entre dll y fll
tambie zipea,pero lo q solo me interesa son las funciones para
codificar y decodificar en base 64
este parece ser el codigo q hace eso
// base64.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "base64.h"
NAMESPACE_BEGIN(CryptoPP)
static const int MAX_LINE_LENGTH = 72;
static const byte vec[] =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static const byte padding = '=';
Base64Encoder::Base64Encoder(BufferedTransformation *outQueue, bool insertLineBreak)
: insertLineBreak(insertLineBreak), Filter(outQueue)
{
inBufSize=0;
lineLength=0;
}
void Base64Encoder::LineBreak()
{
if (insertLineBreak)
AttachedTransformation()->Put('\n');
lineLength=0;
}
void Base64Encoder::EncodeQuantum()
{
byte out;
out=(inBuf[0] & 0xFC) >> 2;
AttachedTransformation()->Put(vec[out]);
out=((inBuf[0] & 0x03) << 4) | (inBuf[1] >> 4);
AttachedTransformation()->Put(vec[out]);
out=((inBuf[1] & 0x0F) << 2) | (inBuf[2] >> 6);
AttachedTransformation()->Put(inBufSize > 1 ? vec[out] : padding);
out=inBuf[2] & 0x3F;
AttachedTransformation()->Put(inBufSize > 2 ? vec[out] : padding);
inBufSize=0;
lineLength+=4;
if (lineLength>=MAX_LINE_LENGTH)
LineBreak();
}
void Base64Encoder::Put(const byte *inString, unsigned int length)
{
while (length--)
Base64Encoder::Put(*inString++);
}
void Base64Encoder::MessageEnd(int propagation)
{
if (inBufSize)
{
for (int i=inBufSize;i<3;i++)
inBuf[i]=0;
EncodeQuantum();
}
if (lineLength) // force a line break unless the current line is empty
LineBreak();
Filter::MessageEnd(propagation);
}
Base64Decoder::Base64Decoder(BufferedTransformation *outQueue)
: Filter(outQueue)
{
inBufSize=0;
}
void Base64Decoder::DecodeQuantum()
{
byte out;
out = (inBuf[0] << 2) | (inBuf[1] >> 4);
AttachedTransformation()->Put(out);
out = (inBuf[1] << 4) | (inBuf[2] >> 2);
if (inBufSize > 2) AttachedTransformation()->Put(out);
out = (inBuf[2] << 6) | inBuf[3];
if (inBufSize > 3) AttachedTransformation()->Put(out);
inBufSize=0;
}
int Base64Decoder::ConvToNumber(byte inByte)
{
if (inByte >= 'A' && inByte <= 'Z')
return (inByte - 'A');
if (inByte >= 'a' && inByte <= 'z')
return (inByte - 'a' + 26);
if (inByte >= '0' && inByte <= '9')
return (inByte - '0' + 52);
if (inByte == '+')
return (62);
if (inByte == '/')
return (63);
return (-1);
}
void Base64Decoder::Put(const byte *inString, unsigned int length)
{
while (length--)
Base64Decoder::Put(*inString++);
}
void Base64Decoder::MessageEnd(int propagation)
{
if (inBufSize)
{
for (int i=inBufSize;i<4;i++)
inBuf[i]=0;
DecodeQuantum();
}
Filter::MessageEnd(propagation);
}
NAMESPACE_END
Como lo puedo usar con fivewin y xharbour
Gracias