encrypt.h 978 B

1234567891011121314151617181920212223242526272829
  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_sum,auth_end};
  13. extern map<int, string> auth_mode_tostring;
  14. enum cipher_mode_t {cipher_none=0,cipher_aes128cbc,cipher_xor,cipher_end};
  15. extern map<int, string> cipher_mode_tostring;
  16. extern auth_mode_t auth_mode;
  17. extern cipher_mode_t cipher_mode;
  18. //const map<int, string> auth_mode_tostring2 = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_sum,"sum"}};
  19. #endif