forked from pig4210/xlib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdes.h
53 lines (44 loc) · 1.39 KB
/
des.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*!
\file des.h
\brief des.h定义了des算法
- 参考来自http://pangzi.is-programmer.com/posts/25161.html
- 参考来自http://www.cnblogs.com/erwin/archive/2009/04/14/1435288.html
\version 1.0.1504.2814
\note For All
\author triones
\date 2013-10-21
*/
#pragma once
#include "xline.h"
//! DES加密
/*!
\param encrypt_data 需要加密的数据指针
\param encrypt_data_size 需要加密数据的长度 >=1
\param encrypt_key 参与加密数据的密钥
\return 返回数据加密结果,当param2 < 1时,返回空串
\code
string aa;
while(cin>>aa)
{
line v = DesEncrypt(aa.c_str(),aa.size(),key);
cout << hex2show(v) << endl;
}
\endcode
*/
line DesEncrypt(const void* encrypt_data,
const size_t encrypt_data_size,
const char* encrypt_key);
//! DES加密
/*!
\param decrypt_data 需要解密的数据指针
\param decrypt_data_size 需要解密数据的长度
\param decrypt_key 参与解密数据的密钥
\return 返回数据解密结果
\code
line v = DesDecrypt(aa.c_str(), aa.size(), key);
cout << hex2show(v) << endl;
\endcode
*/
line DesDecrypt(const void* decrypt_data,
const size_t decrypt_data_size,
const char* decrypt_key);