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 SHA384_SMALL 1
00035 #define SHA384_REASONABLE 0
00036 #define SHA256_SMALL 1
00037 #define SHA256_REASONABLE 0
00038 #define RIPEMD160_SMALL 1
00039 #elif defined HASHCOM_REASONABLE
00040 #define SHA1_SMALL 0
00041 #define SHA512_SMALL 0
00042 #define SHA512_REASONABLE 1
00043 #define SHA384_SMALL 0
00044 #define SHA384_REASONABLE 1
00045 #define SHA256_SMALL 0
00046 #define SHA256_REASONABLE 1
00047 #define RIPEMD160_SMALL 0
00048 #elif defined HASHCOM_LARGE
00049 #define SHA1_SMALL 0
00050 #define SHA512_SMALL 0
00051 #define SHA512_REASONABLE 0
00052 #define SHA384_SMALL 0
00053 #define SHA384_REASONABLE 0
00054 #define SHA256_SMALL 0
00055 #define SHA256_REASONABLE 0
00056 #define RIPEMD160_SMALL 0
00057 #else
00058 #error You must define one of HASHCOM_SMALL HASHCOM_REASONABLE or HASHCOM_LARGE
00059 #endif
00060
00061 #if defined HASHCOM_BASIC_API
00062 #define SHA1_BASIC_API 1
00063 #define SHA512_BASIC_API 1
00064 #define SHA384_BASIC_API 1
00065 #define SHA256_BASIC_API 1
00066 #define RIPEMD160_BASIC_API 1
00067 #else
00068 #define SHA1_BASIC_API 0
00069 #define SHA512_BASIC_API 0
00070 #define SHA384_BASIC_API 1
00071 #define SHA256_BASIC_API 0
00072 #define RIPEMD160_BASIC_API 0
00073 #endif
00074
00075 typedef enum {
00076 CRYPTO_HASH_NONE=0,
00077 CRYPTO_HASH_MD5,
00078 CRYPTO_HASH_SHA1,
00079 CRYPTO_HASH_RIPEMD160,
00080 CRYPTO_HASH_SHA512,
00081 CRYPTO_HASH_SHA384,
00082 CRYPTO_HASH_SHA256,
00083
00084 CRYPTO_HASH_COUNT
00085 } hash_t;
00086
00087 extern const void* crypto_hash_name_arr[CRYPTO_HASH_COUNT][2];
00088 extern const char* crypto_name(const void* tab[][2], int count, int v);
00089 extern unsigned int crypto_name_rev(const void* tab[][2], int count, const char *str);
00090 #define crypto_hash_name(HASH_T)\
00091 crypto_name(crypto_hash_name_arr, CRYPTO_HASH_COUNT, HASH_T)
00092 #define crypto_hash_name_rev(STR)\
00093 ((hash_t)crypto_name_rev(crypto_hash_name_arr, CRYPTO_HASH_COUNT, STR))
00094
00095 extern const char hashcom_PADDING[128];
00096
00097 #ifdef __cplusplus
00098 }
00099 #endif
00100
00101 #ifdef WIN32
00102 #undef extern
00103 #endif
00104
00105 #endif