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 SHA2_SMALL 1
00033 #define SHA2_REASONABLE 0
00034 #define RIPEMD160_SMALL 1
00035 #elif defined HASHCOM_REASONABLE
00036 #define SHA1_SMALL 0
00037 #define SHA2_SMALL 0
00038 #define SHA2_REASONABLE 1
00039 #define RIPEMD160_SMALL 0
00040 #elif defined HASHCOM_LARGE
00041 #define SHA1_SMALL 0
00042 #define SHA2_SMALL 0
00043 #define SHA2_REASONABLE 0
00044 #define RIPEMD160_SMALL 0
00045 #else
00046 #error You must define one of HASHCOM_SMALL HASHCOM_REASONABLE or HASHCOM_LARGE
00047 #endif
00048
00049 #if defined HASHCOM_BASIC_API
00050 #define SHA1_BASIC_API 1
00051 #define SHA2_BASIC_API 1
00052 #define RIPEMD160_BASIC_API 1
00053 #else
00054 #define SHA1_BASIC_API 0
00055 #define SHA2_BASIC_API 0
00056 #define RIPEMD160_BASIC_API 0
00057 #endif
00058
00059 typedef enum {
00060 CRYPTO_HASH_NONE=0,
00061 CRYPTO_HASH_MD5,
00062 CRYPTO_HASH_SHA1,
00063 CRYPTO_HASH_RIPEMD160,
00064 CRYPTO_HASH_SHA2,
00065
00066 CRYPTO_HASH_COUNT
00067 } hash_t;
00068
00069 extern const void* crypto_hash_name_arr[CRYPTO_HASH_COUNT][2];
00070 extern const char* crypto_name(const void* tab[][2], int count, int v);
00071 extern unsigned int crypto_name_rev(const void* tab[][2], int count, const char *str);
00072 #define crypto_hash_name(HASH_T)\
00073 crypto_name(crypto_hash_name_arr, CRYPTO_HASH_COUNT, HASH_T)
00074 #define crypto_hash_name_rev(STR)\
00075 ((hash_t)crypto_name_rev(crypto_hash_name_arr, CRYPTO_HASH_COUNT, STR))
00076
00077 extern const char hashcom_PADDING[128];
00078
00079 #ifdef __cplusplus
00080 }
00081 #endif
00082
00083 #ifdef WIN32
00084 #undef extern
00085 #endif
00086
00087 #endif