Skip to content

Commit

Permalink
more options,help message
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyu- committed Jul 26, 2017
1 parent 93c0d78 commit 66c201e
Show file tree
Hide file tree
Showing 5 changed files with 267 additions and 116 deletions.
3 changes: 3 additions & 0 deletions encrypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ static int8_t zero_iv[]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0};//this prog
extern const int max_data_len;
extern const int buf_len;

map<int, string> auth_mode_tostring = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_sum,"sum"}};
map<int, string> cipher_mode_tostring={{cipher_none,"none"},{cipher_aes128cbc,"aes128cbc"},{cipher_xor,"xor"}};

auth_mode_t auth_mode=auth_sum;
cipher_mode_t cipher_mode=cipher_xor;

Expand Down
12 changes: 10 additions & 2 deletions encrypt.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <map>
#include <string>
using namespace std;
int my_encrypt(const char *data,char *output,int &len,char * key);
int my_decrypt(const char *data,char *output,int &len,char * key);

Expand All @@ -16,9 +19,14 @@ int my_decrypt_pesudo_header(uint8_t *data,uint8_t *output,int &len,uint8_t * ke
unsigned short csum(const unsigned short *ptr,int nbytes) ;


enum auth_mode_t {auth_none=0,auth_md5,auth_crc32,auth_sum};
enum auth_mode_t {auth_none=0,auth_md5,auth_crc32,auth_sum,auth_end};
extern map<int, string> auth_mode_tostring;

enum cipher_mode_t {cipher_none=0,cipher_aes128cbc,cipher_xor};
enum cipher_mode_t {cipher_none=0,cipher_aes128cbc,cipher_xor,cipher_end};
extern map<int, string> cipher_mode_tostring;

extern auth_mode_t auth_mode;
extern cipher_mode_t cipher_mode;
//const map<int, string> auth_mode_tostring2 = {{auth_none, "none"}, {auth_md5, "md5"}, {auth_crc32, "crc32"},{auth_sum,"sum"}};

#endif
4 changes: 2 additions & 2 deletions log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ int log_level=log_info;

int enable_log_position=1;
int enable_log_color=1;
char log_text[][20]={"NEVER","FATAL","ERROR","WARN","INFO","DEBUG","TRACE",""};
char log_color[][20]={RED,RED,RED,YEL,GRN,BLU,""};


void log0(const char * file,const char * function,int line,int level,const char* str, ...) {

if(level>log_level) return ;
Expand Down
4 changes: 4 additions & 0 deletions log.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ const int log_warn=3;
const int log_info=4;
const int log_debug=5;
const int log_trace=6;
const int log_end=7;

const char log_text[][20]={"NEVER","FATAL","ERROR","WARN","INFO","DEBUG","TRACE",""};
const char log_color[][20]={RED,RED,RED,YEL,GRN,BLU,""};

extern int log_level;
extern int enable_log_position;
Expand Down
Loading

0 comments on commit 66c201e

Please sign in to comment.