亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? encoding.cpp

?? PGP—Pretty Good Privacy
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/*
 *  Functions to encode and decode using BASE64 or Quoted-Printable
 *  Also a transfer-encoding header line parser
 *
 *  Filename: encoding.cpp
 *
 *  Last Edited: Friday, August 30, 1996
 *
 *  Author: Scott Manjourides
 *
 *  Portions adopted from code originally written by Stever Dorner.
 *  Copyright 1995, 1996 QUALCOMM Inc.
 *
 *  Send comments and questions to <emsapi-info@qualcomm.com>
 */

#include <windows.h>
#include "ems-win.h"

#include "encoding.h"
#include "rfc822.h"    
#include "string.h" 
#include "ctype.h"   
#include "stdlib.h"

/* ========================================================================= */

#define safefree(p) { if (p) { free(p); (p) = NULL; } }

/* ========================================================================= */

/* Local util functions */
static char *newline_copy(char *dst);
static int newline_test(const char prev, const char curr);
static int hex2dec(const char ch);

/*****************************************************************************/
/*                                B A S E 6 4                                */
/*****************************************************************************/

/* Base64 encoder/decoder ported from Macintosh source by Myra Callen */

#define SKIP (-1)
#define FAIL (-2)
#define PAD  (-3)

#define kNewLine			"\015\012"
#define kNewLineLength (2)

#define ABS(x)   ((x)<0 ? -(x) : (x))

static char *g64EncodeChars = 
	"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
static short g64DecodeArr[] = 
{
	FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,SKIP,SKIP,FAIL,FAIL,SKIP,
		FAIL,FAIL,	/* 0 */
	FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,
	FAIL,FAIL,	/* 1 */
	SKIP,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,0x3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L,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,
	FAIL,FAIL,	/* E */
	FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,FAIL,
	FAIL,FAIL,	/* F */
  /* 0    1    2    3    4    5    6    7    8    9    A    B    C    D    
  E    F  */
};

/*
 * Bit extracting macros
 */
#define Bot2(b) ((b)&0x3)
#define Bot4(b) ((b)&0xf)
#define Bot6(b) ((b)&0x3f)
#define Top2(b) Bot2((b)>>6)
#define Top4(b) Bot4((b)>>4)
#define Top6(b) Bot6((b)>>2)

/*
 * the decoder
 */
#define EncodeThree64(bin,b64,bpl)	EncodeThreeFour(bin,b64,bpl,g64EncodeChars)

#define EncodeThreeFour(bin,b64,bpl,vector)                     \
	do                                                          \
	{                                                           \
		if ((bpl)==68)                                          \
		{                                                       \
			(b64) = newline_copy(b64);                          \
			(bpl) = 0;                                          \
		}                                                       \
		(bpl) += 4;                                             \
		*(b64)++ = vector[Top6((bin)[0])];                      \
		*(b64)++ = vector[Bot2((bin)[0])<<4 | Top4((bin)[1])];  \
		*(b64)++ = vector[Bot4((bin)[1])<<2 | Top2((bin)[2])];  \
		*(b64)++ = vector[Bot6((bin)[2])];                      \
	}                                                           \
	while (0)

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/*
 *  Convert binary data to base64
 *
 *  Args:
 *   binPtr     [IN]     the binary data (or NULL to close encoder)
 *   binLen     [IN]     the length of the binary data
 *   sixFourPtr [IN]     pointer to buffer for the base64 data
 *   e64        [IN/OUT] state; caller must preserve
 *
 *  Returns: The length of the base64 data
 */
long Encode64(
	char *binPtr,
	long binLen,
	char *sixFourPtr,
	Enc64Ptr e64)
{
	char *binSpot;					/* the byte currently being decoded */
	char *sixFourSpot = sixFourPtr;	/* the spot to which to copy the encoded 
									/* chars */
	short bpl;
	char *end;						/* end of integral decoding */

	bpl = e64->bytesOnLine;	/* in inner loop; want local copy */
	
	if (binLen)
	{
		
		/*
		 * do we have any stuff left from last time?
		 */
		if (e64->partialCount)
		{
			short needMore = 3 - e64->partialCount;
			if (binLen >= needMore)
			{
				/*
				 * we can encode some bytes
				 */
				memcpy(e64->partial+e64->partialCount,binPtr,needMore);
				binLen -= needMore;
				binPtr += needMore;
				EncodeThree64(e64->partial,sixFourSpot,bpl);
				e64->partialCount = 0;
			}
			/*
			 * if we don't have enough bytes to complete the leftovers, we
			 * obviously don't have 3 bytes.  So the encoding code will fall
			 * through to the point where we copy the leftovers to the partial
			 * buffer.  As long as we're careful to append and not copy 
			 * blindly, we'll be fine.
			 */
		}
		
		/*
		 * we encode the integral multiples of three
		 */
		end = binPtr + 3*(binLen/3);
		for (binSpot = binPtr; binSpot < end; binSpot += 3)
		{
			EncodeThree64(binSpot,sixFourSpot,bpl);
			/* *sixFourLen = sixFourSpot - sixFourPtr; */
		}
		
		/*
		 * now, copy the leftovers to the partial buffer
		 */
		binLen = binLen % 3;
		if (binLen)
		{
			memcpy(e64->partial+e64->partialCount,binSpot,binLen);
			e64->partialCount += (short)binLen;
		}
	}
	else
	{
		/*
		 * we've been called to cleanup the leftovers
		 */
		if (e64->partialCount)
		{
			if (e64->partialCount<2) e64->partial[1] = 0;
			e64->partial[2] = 0;
			EncodeThree64(e64->partial,sixFourSpot,bpl);
			
			/*
			 * now, replace the unneeded bytes with ='s
			 */
			sixFourSpot[-1] = '=';
			if (e64->partialCount==1) sixFourSpot[-2] = '=';
		}
	}

	e64->bytesOnLine = bpl;	/* copy back to state buffer */

	return (sixFourSpot - sixFourPtr);
}

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/*
 *  Convert base64 data to binary
 *
 *  Args:
 *   sixFourPtr [IN]     the base64 data (or nil to close decoder)
 *   sixFourLen [IN]     the length of the base64 data
 *   binPtr     [IN]     pointer to buffer to hold binary data
 *   d64        [IN/OUT] pointer to decoder state; caller must preserve
 *   decErrCnt  [OUT]    the number of decoding errors found
 *
 *  Returns: The length of the binary data
 */
long Decode64(
	char *sixFourPtr,
	long sixFourLen,
	char *binPtr,
	Dec64Ptr d64,
	long *decErrCnt)
{
	short 	decode;					/* the decoded short */
	unsigned char 		c;															/* the decoded byte */
	/* we separate the short & the byte to the compiler can worry about 
		byteorder */
	char *end = sixFourPtr + sixFourLen;/* stop decoding here */
	char *binSpot = binPtr;				/* current output character */
	short 	decoderState;		/* which of 4 bytes are we seeing now? */
	long 		invalCount;		/* how many bad chars found this time around?*/
	long 		padCount;		/* how many pad chars found so far? */
	unsigned char 		partial;/* partially decoded byte from/for last/
								next time */
	short wasCR;
	char *sixFourStartPtr;
	
	/*
	 * fetch state from caller's buffer
	 */
	decoderState = d64->decoderState;
	invalCount = 0;	/* we'll add the invalCount to the buffer later */
	padCount = d64->padCount;
	partial = d64->partial;
	wasCR = d64->wasCR;
	
	if (sixFourLen)
	{
		sixFourStartPtr = sixFourPtr;
		for (;sixFourPtr<end;sixFourPtr++)
		{
			switch(decode=g64DecodeArr[*sixFourPtr])
			{
				case SKIP: break;				/* skip whitespace */
				case FAIL: invalCount++; break;	/* count invalid characters */
				case PAD: padCount++; break;	/* count pad characters */
				default:
					/*
					 * found a non-pad character, so if we had previously 
					 * found a pad, that pad was an error
				 	*/
					if (padCount) {invalCount+=padCount;padCount=0;}
					
					/*
					 * extract the right bits
					 */
					c = (char) decode;
					switch (decoderState)
					{
						case 0:
							partial = c<<2;
							decoderState++;
							break;
						case 1:
							*binSpot++ = partial|Top4(c);
							partial = Bot4(c)<<4;
							decoderState++;
							break;
						case 2:
							*binSpot++ = partial|Top6(c);
							partial = Bot2(c)<<6;
							decoderState++;
							break;
						case 3:
							*binSpot++ = partial|c;
							decoderState=0;
							break;
					} /* switch decoderState */
			} /* switch decode */
		} /* for sixFourPtr */
	} /* if sixFourLen */
	else
	{
		/*
		 * all done.  Did all end up evenly?
		 */
		switch (decoderState)
		{
			case 0:
				invalCount += padCount;/*	came out evenly, 
											so should be no pads */
				break;
			case 1:
				invalCount++;				/* data missing */
				invalCount += padCount;		/* since data missing; 
												should be no pads */
				break;
			case 2:
				invalCount += ABS(padCount-2);	/* need exactly 2 pads */
				break;
			case 3:
				invalCount += ABS(padCount-1);	/* need exactly 1 pad */
				break;
		}
	}
	
	/*
	 * save state in caller's buffer
	 */
	d64->decoderState = decoderState;
	d64->invalCount += invalCount;
	d64->padCount = padCount;
	d64->partial = partial;
	d64->wasCR = wasCR;

	*decErrCnt = invalCount;

	return (binSpot - binPtr);
}

/*****************************************************************************/
/*                      Q U O T E D - P R I N T A B L E                      */
/*****************************************************************************/

/* ------------------------------------------------------------------------- */
/* NOTE: To handle BINARY data, you must always quote newline characters,    */
/*   this implementation assumes TEXT data and thus does not encode newlines */
/* ------------------------------------------------------------------------- */

/*
 *  Convert binary data to quoted-printable

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲欧美日韩国产综合| 日韩精品一区二区三区四区| 日本精品裸体写真集在线观看| 欧美综合在线视频| 日韩久久精品一区| 国产精品女上位| 亚洲一区二区视频| 国产精品一二三| 色综合久久中文字幕综合网| 91精品免费在线| 国产欧美精品一区二区色综合| 亚洲欧美欧美一区二区三区| 日韩高清不卡一区二区| 风间由美性色一区二区三区| 欧美剧情片在线观看| 久久精品一区四区| 亚洲成人免费视| 国产一区二区三区四区在线观看| 在线观看91视频| 精品国产三级电影在线观看| 亚洲精品国产品国语在线app| 视频一区欧美日韩| 99re视频精品| 久久一二三国产| 伊人一区二区三区| 国产资源精品在线观看| 欧美日韩一级片在线观看| 国产日韩欧美精品综合| 天堂久久久久va久久久久| 成人福利电影精品一区二区在线观看| 666欧美在线视频| 成人欧美一区二区三区白人 | 国产成人精品亚洲日本在线桃色| 91福利小视频| 中文字幕色av一区二区三区| 久久国产尿小便嘘嘘尿| 精品视频在线免费看| 中文字幕av在线一区二区三区| 视频一区中文字幕| 欧美在线观看18| 欧美高清在线精品一区| 久久精品国产一区二区三| 欧美日韩高清一区二区| 亚洲乱码精品一二三四区日韩在线| 激情图区综合网| 欧美一区二区在线免费观看| 一区二区国产盗摄色噜噜| 成人性生交大片| 久久精品欧美日韩| 精品系列免费在线观看| 日韩欧美一卡二卡| 日韩av在线播放中文字幕| 欧美日韩视频第一区| 夜夜操天天操亚洲| 91丨九色丨黑人外教| 国产精品色哟哟| 成人一区二区三区在线观看| 久久久久久久综合| 精品无人码麻豆乱码1区2区 | 美国毛片一区二区| 51久久夜色精品国产麻豆| 一区二区三区精品在线观看| 99国产欧美另类久久久精品| 国产精品国产三级国产aⅴ无密码| 韩国一区二区视频| 久久天天做天天爱综合色| 久久99精品国产| 欧美不卡激情三级在线观看| 日本不卡的三区四区五区| 欧美精品v国产精品v日韩精品 | 在线观看网站黄不卡| 亚洲另类一区二区| 色狠狠综合天天综合综合| 亚洲视频一区二区免费在线观看| av一区二区不卡| 亚洲精品国久久99热| 在线精品视频小说1| 亚洲一区在线观看免费观看电影高清| 一本到不卡免费一区二区| 亚洲六月丁香色婷婷综合久久 | 亚洲一区二区精品久久av| 色乱码一区二区三区88| 亚洲一卡二卡三卡四卡无卡久久| 91福利资源站| 午夜欧美在线一二页| 欧美一区二区三区系列电影| 精品一区二区三区在线播放视频| 久久久久久黄色| 成人18视频日本| 一区二区三区在线播放| 91麻豆精品国产91久久久使用方法 | 午夜亚洲国产au精品一区二区 | 麻豆精品视频在线| 26uuu亚洲| 成人动漫一区二区在线| 亚洲影视在线观看| 7799精品视频| 国产精品一线二线三线| 亚洲欧美怡红院| 欧美二区乱c少妇| 国产精品99久久久久久宅男| 欧美激情中文字幕一区二区| 色系网站成人免费| 日日夜夜一区二区| 久久久国产精品麻豆| 91论坛在线播放| 免费xxxx性欧美18vr| 亚洲国产精品久久人人爱蜜臀| 91精品欧美福利在线观看| 国产成人免费视频精品含羞草妖精 | 久久黄色级2电影| 国产精品免费久久久久| 欧美中文字幕久久| 狠狠色综合播放一区二区| 国产精品电影一区二区| 91精品国产福利| 成年人国产精品| 免费成人在线影院| 亚洲欧美中日韩| 日韩欧美不卡一区| 色综合中文字幕| 韩国精品一区二区| 亚洲综合色婷婷| 国产拍揄自揄精品视频麻豆| 欧美偷拍一区二区| 国产成人av电影在线| 五月天激情综合网| 中文字幕一区二| 日韩午夜av电影| 91丨九色porny丨蝌蚪| 九九在线精品视频| 夜夜揉揉日日人人青青一国产精品| 欧美成人午夜电影| 一本大道久久a久久精品综合| 久久精品国产999大香线蕉| 亚洲综合av网| 国产精品国产自产拍在线| 日韩免费性生活视频播放| 91老师国产黑色丝袜在线| 国产一区二区视频在线播放| 偷拍自拍另类欧美| 亚洲色图制服丝袜| 国产午夜久久久久| 欧美一级片在线| 在线一区二区视频| 成人av综合一区| 国产自产2019最新不卡| 日本v片在线高清不卡在线观看| 亚洲男帅同性gay1069| 久久精品综合网| 精品卡一卡二卡三卡四在线| 欧美日韩一区二区在线视频| 99久久国产免费看| 国产精品亚洲第一区在线暖暖韩国| 日本视频在线一区| 亚洲成av人片在线观看| 一区二区三区在线免费观看| 国产精品久久毛片av大全日韩| 久久久国产精品麻豆| 欧美mv和日韩mv国产网站| 日韩一区二区在线免费观看| 欧美日韩国产综合一区二区 | 亚洲午夜久久久久久久久电影院 | 欧美在线免费观看亚洲| 91年精品国产| 99久久婷婷国产综合精品| 国产精品一区二区男女羞羞无遮挡| 蜜臀99久久精品久久久久久软件| 午夜在线电影亚洲一区| 亚洲综合999| 亚洲电影一级黄| 亚洲成人手机在线| 午夜激情久久久| 亚洲.国产.中文慕字在线| 亚洲成人资源在线| 午夜婷婷国产麻豆精品| 午夜亚洲福利老司机| 首页国产欧美久久| 秋霞午夜鲁丝一区二区老狼| 免费成人深夜小野草| 久久精品国产第一区二区三区| 免费成人美女在线观看.| 久草中文综合在线| 国产激情一区二区三区| 国产伦精一区二区三区| 国产精品一级二级三级| 成人av手机在线观看| 色综合天天综合| 91成人在线精品| 在线不卡中文字幕播放| 欧美一级生活片| 久久综合av免费| 久久久高清一区二区三区| 国产精品女同一区二区三区| 亚洲少妇最新在线视频| 亚洲国产成人av| 麻豆久久久久久久| 国产福利91精品一区| 99国产精品久久久| 欧洲亚洲精品在线|