TSunmix 0.2
src/CBlowfish.h
00001 /* 
00002  * File:   CBlowfish.h
00003  * Author: ivosh-l
00004  *
00005  * Created on 29. prosinec 2011, 18:53
00006  */
00007 
00008 #ifndef CBLOWFISH_H
00009 #define CBLOWFISH_H
00010 
00011 typedef unsigned char byte;
00012 typedef unsigned short word;
00013 typedef unsigned long dword;
00014 
00015 typedef dword t_bf_p[18];
00016 typedef dword t_bf_s[4][256];
00017 
00018 class Cblowfish
00019 {
00020 public:
00021     void set_key(const byte* key, int cb_key);
00022     void encipher(dword& xl, dword& xr) const;
00023     void encipher(const void* s, void* d, int size) const;
00024     void decipher(dword& xl, dword& xr) const;
00025     void decipher(const void* s, void* d, int size) const;
00026 private:
00027     dword S(dword x, int i) const;
00028     dword bf_f(dword x) const;
00029     void ROUND(dword& a, dword b, int n) const;
00030 
00031     t_bf_p m_p;
00032     t_bf_s m_s;
00033 };
00034 
00035 #endif  /* CBLOWFISH_H */
00036 
 All Classes Functions