encrypt.h 897 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef _ENCRYPTION_H_
  2. #define _ENCRYPTION_H_
  3. //#include "aes.h"
  4. //#include "md5.h"
  5. #include "common.h"
  6. //using namespace std;
  7. int my_encrypt(const char *data,char *output,int &len,char * key);
  8. int my_decrypt(const char *data,char *output,int &len,char * key);
  9. int my_encrypt_pesudo_header(uint8_t *data,uint8_t *output,int &len,uint8_t * key,uint8_t *header,int hlen);
  10. int my_decrypt_pesudo_header(uint8_t *data,uint8_t *output,int &len,uint8_t * key,uint8_t *header,int hlen);
  11. unsigned short csum(const unsigned short *ptr,int nbytes) ;
  12. enum auth_mode_t {auth_none=0,auth_md5,auth_crc32,auth_simple,auth_end};
  13. enum cipher_mode_t {cipher_none=0,cipher_aes128cbc,cipher_xor,cipher_end};
  14. extern auth_mode_t auth_mode;
  15. extern cipher_mode_t cipher_mode;
  16. extern unordered_map<int, const char *> auth_mode_tostring;
  17. extern unordered_map<int, const char *> cipher_mode_tostring;
  18. #endif