Main Page   Compound List   File List   Compound Members   File Members  

hashcom.h

Go to the documentation of this file.
00001 
00012 #ifndef HASHCOM_H
00013 #define HASHCOM_H
00014 
00015 #include <string.h>
00016 #include "mainDefs.h"
00017 
00018 #ifdef __cplusplus
00019 extern "C" {
00020 #endif
00021 
00022 #ifdef WIN32
00023  #ifdef CRYPTO_EXPORTS
00024    #define extern   extern __declspec(dllexport)
00025  #else
00026    #define extern   extern __declspec(dllimport)
00027  #endif
00028 #endif
00029  
00030 #if defined HASHCOM_SMALL
00031   #define SHA1_SMALL 1
00032   #define SHA512_SMALL 1
00033   #define SHA512_REASONABLE 0
00034   #define SHA256_SMALL 1
00035   #define SHA256_REASONABLE 0
00036   #define RIPEMD160_SMALL 1
00037 #elif defined HASHCOM_REASONABLE
00038   #define SHA1_SMALL 0
00039   #define SHA512_SMALL 0
00040   #define SHA512_REASONABLE 1
00041   #define SHA256_SMALL 0
00042   #define SHA256_REASONABLE 1
00043   #define RIPEMD160_SMALL 0
00044 #elif defined HASHCOM_LARGE
00045   #define SHA1_SMALL 0
00046   #define SHA512_SMALL 0
00047   #define SHA512_REASONABLE 0
00048   #define SHA256_SMALL 0
00049   #define SHA256_REASONABLE 0
00050   #define RIPEMD160_SMALL 0
00051 #else
00052   #error You must define one of HASHCOM_SMALL HASHCOM_REASONABLE or HASHCOM_LARGE
00053 #endif
00054   
00055 #if defined HASHCOM_BASIC_API
00056   #define SHA1_BASIC_API 1
00057   #define SHA512_BASIC_API 1
00058   #define SHA256_BASIC_API 1
00059   #define RIPEMD160_BASIC_API 1
00060 #else
00061   #define SHA1_BASIC_API 0
00062   #define SHA512_BASIC_API 0
00063   #define SHA256_BASIC_API 0
00064   #define RIPEMD160_BASIC_API 0
00065 #endif
00066   
00067 typedef enum {
00068  CRYPTO_HASH_NONE=0,
00069  CRYPTO_HASH_MD5,
00070  CRYPTO_HASH_SHA1,
00071  CRYPTO_HASH_RIPEMD160,
00072  CRYPTO_HASH_SHA512,
00073  CRYPTO_HASH_SHA256,
00074 
00075  CRYPTO_HASH_COUNT /* LEAVE THIS HERE! */
00076 } hash_t;
00077  
00078 extern const void* crypto_hash_name_arr[CRYPTO_HASH_COUNT][2];
00079 extern const char* crypto_name(const void* tab[][2], int count, int v);
00080 extern unsigned int crypto_name_rev(const void* tab[][2], int count, const char *str);
00081 #define crypto_hash_name(HASH_T)\
00082   crypto_name(crypto_hash_name_arr, CRYPTO_HASH_COUNT, HASH_T)
00083 #define crypto_hash_name_rev(STR)\
00084   ((hash_t)crypto_name_rev(crypto_hash_name_arr, CRYPTO_HASH_COUNT, STR))
00085 
00086 extern const char hashcom_PADDING[128];
00087 
00088 #ifdef __cplusplus
00089 }
00090 #endif
00091 
00092 #ifdef WIN32
00093   #undef extern
00094 #endif
00095 
00096 #endif


GPL