Skip to content

A simple c lib to calc md5, tea, and lua binding

Notifications You must be signed in to change notification settings

synodriver/simple-crypto

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simple-crypto

Simple C lib of the MD5 & TEA algorithm

Install

git clone https://github.com/fumiama/simple-crypto.git
cd simple-crypto
mkdir build
cd build
cmake ..
make
make install

Usage

  1. Include simplecrypto.h in your c program.
#include <simplecrypto.h>
  1. Call functions. Don't forget to free the returned digest.
int64_t tea_encrypt_qq(const uint32_t t[4], const uint8_t *src, int64_t src_len, uint8_t *out, int64_t out_len);
int64_t tea_encrypt(const uint32_t t[4], const uint32_t sumtable[0x10], const uint8_t *src, int64_t src_len, uint8_t *out,
                    int64_t out_len);
int64_t tea_encrypt_native_endian(const uint32_t t[4], const uint32_t sumtable[0x10], const uint8_t *src, int64_t src_len,
                          uint8_t *out, int64_t out_len);
int64_t tea_decrypt_qq(const uint32_t t[4], const uint8_t *src, int64_t src_len, uint8_t *out, int64_t out_len);
int64_t tea_decrypt(const uint32_t t[4], const uint32_t sumtable[0x10], const uint8_t *src, int64_t src_len, uint8_t *out,
            int64_t out_len);
int64_t tea_decrypt_native_endian(const uint32_t t[4], const uint32_t sumtable[0x10], const uint8_t *src, int64_t src_len,
                          uint8_t *out, int64_t out_len);
  1. Optional lua binding
local tea = require("tea")


local encoded = tea.encrypt_qq("32107654BA98FEDC", "hahaha")
print(encoded)

print(tea.decrypt_qq("32107654BA98FEDC",encoded))


tea.encrypt("32107654BA98FEDC", sumtableof64bits,"hahaha")
tea.decrypt("32107654BA98FEDC", sumtableof64bits,"hahaha")

tea.encrypt_native_endian("32107654BA98FEDC", sumtableof64bits,"hahaha")
tea.decrypt_native_endian("32107654BA98FEDC", sumtableof64bits,"hahaha")

About

A simple c lib to calc md5, tea, and lua binding

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 95.8%
  • CMake 3.6%
  • Lua 0.6%