1 #ifndef __ENCODING_HPP__ 2 #define __ENCODING_HPP__ 15 template <
typename _ChTy >
16 XString<_ChTy>
UrlEncode(
void const * buf,
size_t size );
26 template < typename _ChTy >
28 template <
typename _ChTy >
31 #if defined(_UNICODE) || defined(UNICODE) 43 template <
typename _ChTy >
55 template <
typename _ChTy >
66 #if defined(_UNICODE) || defined(UNICODE) 79 template <
typename _ChTy >
90 template <
typename _ChTy >
92 template <
typename _ChTy >
95 #if defined(_UNICODE) || defined(UNICODE) 107 template <
typename _ChTy >
119 template <
typename _ChTy >
130 #if defined(_UNICODE) || defined(UNICODE) 161 template <
typename _ChTy >
173 template <
typename _ChTy >
177 template <
typename _ChTy >
181 #if defined(_UNICODE) || defined(UNICODE) 193 template <
typename _ChTy >
206 template <
typename _ChTy >
218 #if defined(_UNICODE) || defined(UNICODE) 228 template <
typename _ChTy >
240 #if defined(_UNICODE) || defined(UNICODE) 248 template <
typename _ChTy >
260 #if defined(_UNICODE) || defined(UNICODE) 273 template <
typename _ChTy >
276 template <
typename _ChTy >
280 #if defined(_UNICODE) || defined(UNICODE) 281 inline UnicodeString Md5Hex(
void const * buf,
size_t size ) {
return BufferToHex<wchar>(
Md5( buf, size ) ); }
284 inline AnsiString Md5Hex(
void const * buf,
size_t size ) {
return BufferToHex<char>(
Md5( buf, size ) ); }
295 template <
typename _ChTy >
298 template <
typename _ChTy >
302 #if defined(_UNICODE) || defined(UNICODE) 306 inline AnsiString Sha1Hex(
void const * buf,
size_t size ) {
return BufferToHex<char>(
Sha1( buf, size ) ); }
317 template <
typename _ChTy >
320 template <
typename _ChTy >
324 #if defined(_UNICODE) || defined(UNICODE) 339 template <
typename _ChTy >
342 template <
typename _ChTy >
346 #if defined(_UNICODE) || defined(UNICODE) 361 template <
typename _ChTy >
364 template <
typename _ChTy >
368 #if defined(_UNICODE) || defined(UNICODE) 383 template <
typename _ChTy >
386 template <
typename _ChTy >
390 #if defined(_UNICODE) || defined(UNICODE) 421 #define EncryptCArray(data) EncryptContent( CBufferToAnsiString( data, sizeof(data) ) ) 422 #define EncryptCBuffer( buf, size ) EncryptContent( CBufferToAnsiString( buf, size ) ) 423 #define DecryptCArray(data) DecryptContent( CBufferToAnsiString( data, sizeof(data) ) ) 424 #define DecryptCBuffer( buf, size ) DecryptContent( CBufferToAnsiString( buf, size ) ) 429 #endif // __ENCODING_HPP__ XString< char > AnsiString
XString< _ChTy > Sha384Hex(void const *buf, size_t size)
将数据进行sha384编码,返回16进制数字符串
Buffer Sha512(void const *buf, size_t size)
将数据进行sha512编码,返回二进制数据
XString< _ChTy > Base64Encode(void const *buf, size_t size)
Base64编码
AnsiString Base64Decode(XString< _ChTy > const &base64Str)
Base64解码,与Base64Encode()配套
XString< wchar > UnicodeString
void * getBuf() const
暴露缓冲区指针
Buffer Sha384(void const *buf, size_t size)
将数据进行sha384编码,返回二进制数据
XString< _ChTy > UriComponentEncodeBuffer(Buffer const &buf)
Buffer Sha1(void const *buf, size_t size)
将数据进行sha1编码,返回二进制数据
Buffer Sha256(void const *buf, size_t size)
将数据进行sha256编码,返回二进制数据
size_t getSize() const
获取数据大小
String UrlDecodeString(String const &encodedStr, bool isUtf8=sizeof(String::value_type)==sizeof(wchar))
URL解码,与UrlEncodeString()配套
String UriComponentEncodeString(String const &str, bool asUtf8=sizeof(String::value_type)==sizeof(wchar))
URI组成部分编码,遵循RFC1738.
AnsiString EncryptContent(AnsiString const &content)
内容加密
AnsiString DecryptContent(AnsiString const &encryptContent)
内容解密,与EncryptContent()配套
int RawDecrypt(byte const *encryptData, size_t dataSize, byte *buf, size_t bufSize, size_t *outSize)
未进行C++包装的内容解密,与RawEncrypt()配套
XString< _ChTy > BufferToHex(Buffer const &buf)
二进制数据转成16进制串
XString< _ChTy > Md5Hex(void const *buf, size_t size)
将数据进行md5编码,返回16进制数字符串
std::basic_string< _ChTy, std::char_traits< _ChTy >, std::allocator< _ChTy > > XString
缓冲区,表示内存中一块二进制数据(利用malloc/realloc进行内存分配)
int RawEncrypt(byte const *data, size_t dataSize, byte *buf, size_t bufSize, size_t *outSize)
未进行C++包装的内容加密
Buffer HexToBuffer(XString< _ChTy > const &hexStr)
16进制串转成二进制数据
String HtmlEncode(String const &str)
HTML编码。作用字符:'&', '<', '>', ' '.
XString< _ChTy > UriComponentEncode(void const *buf, size_t size)
URI组成部分编码,遵循RFC1738.
Buffer Base64DecodeBuffer(XString< _ChTy > const &base64Str)
Base64解码,与Base64Encode()配套
XString< _ChTy > UrlEncode(void const *buf, size_t size)
URL编码
Buffer Sha224(void const *buf, size_t size)
将数据进行sha224编码,返回二进制数据
#define WINUX_FUNC_DECL(ret)
XString< _ChTy > Sha224Hex(void const *buf, size_t size)
将数据进行sha224编码,返回16进制数字符串
XString< _ChTy > Base64EncodeBuffer(Buffer const &buf)
Base64编码
AnsiString UriComponentDecode(XString< _ChTy > const &encodedStr)
URI组成部分编码,与UriComponentEncode()配套
Buffer Md5(void const *buf, size_t size)
将数据进行md5编码,返回二进制数据
XString< _ChTy > Sha512Hex(void const *buf, size_t size)
将数据进行sha512编码,返回16进制数字符串
AnsiString UrlDecode(XString< _ChTy > const &encodedStr)
URL编码,与UrlEncode()配套
Buffer UriComponentDecodeBuffer(XString< _ChTy > const &encodedStr)
URI组成部分编码,与UriComponentEncodeBuffer()配套
XString< _ChTy > UrlEncodeBuffer(Buffer const &buf)
XString< _ChTy > Sha1Hex(void const *buf, size_t size)
将数据进行sha1编码,返回16进制数字符串
String UrlEncodeString(String const &str, bool asUtf8=sizeof(String::value_type)==sizeof(wchar))
URL编码
String HtmlDecode(String const &str)
HTML解码。与HtmlEncode()配套
String UriComponentDecodeString(String const &encodedStr, bool isUtf8=sizeof(String::value_type)==sizeof(wchar))
URI组成部分解码,与UriComponentEncodeString()配套
Buffer UrlDecodeBuffer(XString< _ChTy > const &encodedStr)
URL编码,与UrlEncodeBuffer()配套
XString< _ChTy > Sha256Hex(void const *buf, size_t size)
将数据进行sha256编码,返回16进制数字符串