?? base64coder.cpp
字號:
/**************************************************************************/
/* */
/* Copyright (c) 2000-2008 YULONG Company */
/* 宇龍計算機通信科技(深圳)有限公司 版權(quán)所有 2000-2008 */
/* */
/* PROPRIETARY RIGHTS of YULONG Company are involved in the */
/* subject matter of this material. All manufacturing, reproduction, use,*/
/* and sales rights pertaining to this subject matter are governed by the */
/* license agreement. The recipient of this software implicitly accepts */
/* the terms of the license. */
/* 本軟件文檔資料是宇龍公司的資產(chǎn),任何人士閱讀和使用本資料必須獲得 */
/* 相應的書面授權(quán),承擔保密責任和接受相應的法律約束. */
/* */
/**************************************************************************
Copyright (C), 2000-2010, Yulong Tech. Co., Ltd.
FileName:
Author: zhanglei
Version : 1.0
Date: 2007年10月22號
Description:
History:
<author> <time> <version > <desc>
zhanglei 2007/10/22 1.0 Create this moudle
*****************************************************************************/
#include "StdAfx.h"
#include "Base64Coder.h"
#include "base64.h"
CBase64Coder::CBase64Coder(void)
{
}
CBase64Coder::~CBase64Coder(void)
{
}
int CBase64Coder::encode( char * content, int csize, LPCTSTR key, int ksize )
{
int nOffset = 0;
int nPasswordLen = csize;
int nB64Size = base64GetSize(nPasswordLen);
char *pszBase64 = new char[nB64Size+1];
memset(pszBase64, 0, nB64Size+1);
base64Encode((unsigned char *)pszBase64, nB64Size, (unsigned char *)(LPCSTR)content, (unsigned long *)&nPasswordLen, (unsigned long*)&nOffset, true, 0);
ZeroMemory(content, ((csize + 1) * sizeof(char)));
strcpy(content, pszBase64);
delete[] pszBase64;
return 0;
}
int CBase64Coder::decode( char * content, int csize, LPCTSTR key, int ksize )
{
int nOffset = 0;
int nPasswordLen = csize;
int nB64Size = base64GetSize(nPasswordLen);
char *pszBase64 = new char[nB64Size+1];
memset(pszBase64, 0, nB64Size+1);
base64Encode((unsigned char *)pszBase64, nB64Size, (unsigned char *)(LPCSTR)content, (unsigned long *)&nPasswordLen, (unsigned long*)&nOffset, true, 0);
ZeroMemory(content, ((csize + 1) * sizeof(char)));
strcpy(content, pszBase64);
delete[] pszBase64;
return 0;
}
int CBase64Coder::encodeFile( LPTSTR path, LPCTSTR key )
{
return 0;
}
int CBase64Coder::decodeFile( LPTSTR path, LPCTSTR key )
{
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -