谁会C语言和易语言的,帮我看下这两个C语言函数
char * WINAPI Base64Enc(int p, int size) {
unsigned char *text = (unsigned char *)p;
char *out = (char *)malloc((size+(3-size%3)%3) * 4 / 3 + 1);
char *buf = out;
int buflen = 0;
while(size>0)
{
*buf++ = ((text[0] >> 2 ) & 0x3f) + 0x30;
*buf++ = (((text[0] & 3) << 4) | (text[1] >> 4)) + 0x30;
*buf++ = (((text[1] & 0xF) << 2) | (text[2] >> 6)) + 0x30;
*buf++ = (text[2] & 0x3F) + 0x30;
text +=3;
size -=3;
buflen +=4;
}
*buf = 0;
return out;
}
char * WINAPI Base64Dec(char * in, int * len)
{
if(in == NULL)
return NULL;
unsigned char * str_add=(unsigned char *)in;
int size=strlen(in);
unsigned char * str_back2 = (unsigned char *) malloc(size);
memset(str_back2,0,size);
unsigned char * str_back = str_back2;
while(str_add[0]&&str_add[1]&&str_add[2]&&str_add[3])
{
str_back[0] = ( ( ( str_add[0] - 0x30) << 2 ) & 0xFC ) + ( ( ( str_add[1] - 0x30 ) >> 4 ) & 0x03 );
str_back[1] = ( ( ( str_add[1] - 0x30) << 4 ) & 0xF0 ) + ( ( ( str_add[2] - 0x30 ) >> 2 ) & 0x0F );
str_back[2] = ( ( ( str_add[2] - 0x30) << 6 ) & 0xC0 ) + ( (str_add[3] - 0x30 ) & 0x3F);
str_add += 4;
str_back += 3;
}
*len = str_back2 - str_back;
return (char *)str_back2;
}
以上是BASE64加密解密的两个函数,谁能帮我看看到底什么意思,(C语言我完全不懂),懂的人能否参考http://里的第二个例子,“lucy”这样,帮我写一下从ascii到最后输出的加密字符的过程写一下。
如果懂易语言的,帮我写成子程序最好不过了。。。