1
0
mirror of https://github.com/fumiama/simple-crypto.git synced 2026-06-11 06:00:24 +08:00
This commit is contained in:
fumiama
2021-12-11 17:36:08 +08:00
parent bd25ddf9f6
commit 80c7ea2afc
6 changed files with 476 additions and 194 deletions

31
simplecrypto.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef _SIMPLE_MD5_H_
#define _SIMPLE_MD5_H_
#include <stdio.h>
#include <stdint.h>
// ---------------MD5 area---------------
// return 128bit(16bytes) digest
uint8_t* md5(const uint8_t *data, size_t data_len);
// ---------------MD5 area---------------
// ---------------TEA area---------------
typedef uint32_t TEA;
struct TEADAT {
int64_t len;
uint8_t* data;
void* ptr; // free() must use this val
};
typedef struct TEADAT TEADAT;
TEADAT* tea_encrypt_qq(const TEA t[4], const TEADAT* src);
TEADAT* tea_encrypt(const TEA t[4], const uint32_t sumtable[0x10], const TEADAT* src);
TEADAT* tea_decrypt_qq(const TEA t[4], const TEADAT* src);
TEADAT* tea_decrypt(const TEA t[4], const uint32_t sumtable[0x10], const TEADAT* src);
// ---------------TEA area---------------
#endif