forked from xxtea/xxtea-c
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxxtea.h
54 lines (47 loc) · 1.85 KB
/
xxtea.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
54
/**********************************************************\
| |
| xxtea.h |
| |
| XXTEA encryption algorithm library for C. |
| |
| Encryption Algorithm Authors: |
| David J. Wheeler |
| Roger M. Needham |
| |
| Code Authors: Chen fei <cf850118@163.com> |
| Ma Bingyao <mabingyao@gmail.com> |
| LastModified: Mar 3, 2015 |
| |
\**********************************************************/
#ifndef XXTEA_INCLUDED
#define XXTEA_INCLUDED
#include <stdlib.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* Function: xxtea_encrypt
* @data: Data to be encrypted
* @len: Length of the data to be encrypted
* @key: Symmetric key
* @out_len: Pointer to output length variable
* Returns: Encrypted data or %NULL on failure
*
* Caller is responsible for freeing the returned buffer.
*/
void * xxtea_encrypt(const void * data, size_t len, const void * key, size_t * out_len);
/**
* Function: xxtea_decrypt
* @data: Data to be decrypted
* @len: Length of the data to be decrypted
* @key: Symmetric key
* @out_len: Pointer to output length variable
* Returns: Decrypted data or %NULL on failure
*
* Caller is responsible for freeing the returned buffer.
*/
void * xxtea_decrypt(const void * data, size_t len, const void * key, size_t * out_len);
#ifdef __cplusplus
}
#endif
#endif