メインページ | 構成 | ファイル一覧 | 構成メンバ | ファイルメンバ | 関連ページ

dkcBlowfish.h

説明を見る。
00001 
00012 #ifndef dkutil_c_Blowfish
00013 #define dkutil_c_Blowfish
00014 
00015 #include "dkcOSIndependent.h"
00016 
00017 #define MAXKEYBYTES     56      // 448 bits max
00018 #define NPASS           16      // SBox passes
00019 
00021 #define dkcd_BLOWFISH_MAX_KEY_SIZE MAXKEYBYTES
00022 
00023 #ifndef DWORD
00024 #define DWORD       unsigned long
00025 #endif
00026 #ifndef WORD
00027 #define WORD        unsigned short
00028 #endif
00029 #ifndef BYTE
00030 #define BYTE        unsigned char
00031 #endif
00032 
00033 
00034 typedef DWORD       (*DKC_BLOWFISH_SBOX_TYPE)[256];
00035 
00036 typedef struct dkc_Blowfish{
00037     DWORD       * PArray ;
00038     //DWORD     (* SBoxes)[256];
00039     DKC_BLOWFISH_SBOX_TYPE SBoxes;
00040 }DKC_BLOWFISH;
00041 
00049 DKC_EXTERN DKC_BLOWFISH *WINAPI dkcAllocBlowfish(BYTE *key,int keysize);
00050 
00052 DKC_EXTERN int WINAPI dkcFreeBlowfish(DKC_BLOWFISH **);
00060 
00061 DKC_EXTERN int WINAPI dkcBlowfishInit(DKC_BLOWFISH *p,BYTE *key, int keybytes);
00062 
00063 
00064 DWORD WINAPI dkcBlowfishGetOutputLength (DWORD lInputLong);
00070 DKC_EXTERN DWORD WINAPI dkcBlowfishEncrypt(DKC_BLOWFISH *p,BYTE * pInput, BYTE * pOutput, DWORD lSize);
00075 DKC_EXTERN void WINAPI dkcBlowfishDecrypt (DKC_BLOWFISH *p,BYTE * pInput, BYTE * pOutput, DWORD lSize);
00076 
00077 
00078 
00079 
00081 #define ORDER_DCBA  // chosing Intel in this case
00082 
00083 #ifdef ORDER_DCBA   // DCBA - little endian - intel
00084     union aword {
00085       DWORD dword;
00086       BYTE byte [4];
00087       struct {
00088         unsigned int byte3:8;
00089         unsigned int byte2:8;
00090         unsigned int byte1:8;
00091         unsigned int byte0:8;
00092       } w;
00093     };
00094 #endif
00095 
00096 #ifdef ORDER_ABCD   // ABCD - big endian - motorola
00097     union aword {
00098       DWORD dword;
00099       BYTE byte [4];
00100       struct {
00101         unsigned int byte0:8;
00102         unsigned int byte1:8;
00103         unsigned int byte2:8;
00104         unsigned int byte3:8;
00105       } w;
00106     };
00107 #endif
00108 
00109 #ifdef ORDER_BADC   // BADC - vax
00110     union aword {
00111       DWORD dword;
00112       BYTE byte [4];
00113       struct {
00114         unsigned int byte1:8;
00115         unsigned int byte0:8;
00116         unsigned int byte3:8;
00117         unsigned int byte2:8;
00118       } w;
00119 };
00120 #endif
00121 
00122 
00123 #endif //end of include once

dkutil_cに対してSun Jul 18 22:45:21 2004に生成されました。 doxygen 1.3.6