📄 base64coder.cpp
字号:
/**************************************************************************/
/* */
/* Copyright (c) 2000-2008 YULONG Company */
/* 宇龙计算机通信科技(深圳)有限公司 版权所有 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. */
/* 本软件文档资料是宇龙公司的资产,任何人士阅读和使用本资料必须获得 */
/* 相应的书面授权,承担保密责任和接受相应的法律约束. */
/* */
/**************************************************************************
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 + -