F
fftou
Unregistered / Unconfirmed
GUEST, unregistred user!
int UGC( char * p, BYTE * out )
{
int i = 0;
int ilen = 0, olen = 0;
int iptr = 0, optr = 0;
BYTE * pb = (BYTE*)p;
BYTE b1,b2,b3,b4;
if( p == NULL || out == NULL)
return 0;
ilen = strlen( p );
if( ilen <= 0 )
return 0;
*((DWORD*)&p[ilen]) = 0x3c3c3c;
olen = (ilen * 6) / 8;
for( i =0;i < ((ilen + 3)/4);i ++ )
{
b1 = (pb[iptr++] - 0x3c) & 0x3f;
b2 = (pb[iptr++] - 0x3c) & 0x3f;
b3 = (pb[iptr++] - 0x3c) & 0x3f;
b4 = (pb[iptr++] - 0x3c) & 0x3f;
out[optr++] =(( b1 & b00111111) << 2 )| ((b2 & b00110000) >> 4);
out[optr++] =(( b2 & b00001111) << 4 )| ((b3 & b00111100) >> 2);
out[optr++] =(( b3 & b00000011) << 6 )| b4;
}
out[olen] = '/0';
return olen;
}
{
int i = 0;
int ilen = 0, olen = 0;
int iptr = 0, optr = 0;
BYTE * pb = (BYTE*)p;
BYTE b1,b2,b3,b4;
if( p == NULL || out == NULL)
return 0;
ilen = strlen( p );
if( ilen <= 0 )
return 0;
*((DWORD*)&p[ilen]) = 0x3c3c3c;
olen = (ilen * 6) / 8;
for( i =0;i < ((ilen + 3)/4);i ++ )
{
b1 = (pb[iptr++] - 0x3c) & 0x3f;
b2 = (pb[iptr++] - 0x3c) & 0x3f;
b3 = (pb[iptr++] - 0x3c) & 0x3f;
b4 = (pb[iptr++] - 0x3c) & 0x3f;
out[optr++] =(( b1 & b00111111) << 2 )| ((b2 & b00110000) >> 4);
out[optr++] =(( b2 & b00001111) << 4 )| ((b3 & b00111100) >> 2);
out[optr++] =(( b3 & b00000011) << 6 )| b4;
}
out[olen] = '/0';
return olen;
}