⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 base64.c.bak

📁 关于arm7开发的一个程序
💻 BAK
字号:
/********************************************************************************
//		base64.c
//
//
********************************************************************************/


#define _IN_BASE64_
#include "config.h"
static char Base64_table[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; 
int8 Base64_decode(uint8 *src,uint8 *dst)
{
	uint16 length,i,j,cat;
	uint8 temp[4],DST_TEMP[3500];
	char *p,*p_to_table;
	p_to_table=Base64_table;
	length=strlen((char *)src);//获取源字符串的长度 
	for(i=0;i<length;i++)//解码出源代码
		{
			 
				  p=strchr(Base64_table,src[i]);
				  if(!p)
				  	{
				  		src[i]=0;
				  		break;
				  		}
					 dst[i] = p - p_to_table;
					 //tem_pionter[i]=dst[i];
			}
		if((length%4)!=0) //不是4的倍数
				length=length-length%4;///凑够4的倍数
		//j=length/4;//程序主体要预算的次数
	//**重新组合数据
	
		for(j=0,i=0;j<length;j+=4,i+=3)
		{
			
			temp[0]=(dst[j+0]<<2)+((dst[j+1] & 0x30 )>>4);
			temp[1]=((dst[j+1]& 0x0f)<<4)+((dst[j+2] & 0x3c)>>2);
			temp[2]=((dst[j+2]& 0x03)<<6)+(dst[j+3] & 0x3f);
			////转存到dst

				dst[j+0]=0;
				dst[j+1]=0;
				dst[j+2]=0;
				dst[j+3]=0;	
				///清掉数据 		
				dst[i+0]=temp[0];
				dst[i+1]=temp[1];
				dst[i+2]=temp[2];
				cat=i;
			}
			memcpy(DST_TEMP,dst,cat+3);
			DST_TEMP[cat+4]='\0';
			memcpy(dst,DST_TEMP,cat+3);
		//	dst[cat+3]='\0';
			//dst[]
	//for(;i<length-3;i++)dst[i+3]=0x0;
	return 1;
	}	
//2005-12-15 14:34


/******************************************************************************
//	
//													end of file
******************************************************************************/









⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -