Lines 75-105
Link Here
|
75 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
75 |
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
76 |
}; |
76 |
}; |
77 |
|
77 |
|
78 |
const void* crypto_hash_name_arr[CRYPTO_HASH_COUNT][2] = { |
78 |
const char* crypto_hash_name_arr[CRYPTO_HASH_COUNT] = { |
79 |
{(void*)CRYPTO_HASH_NONE, "None"}, |
79 |
"None", |
80 |
{(void*)CRYPTO_HASH_MD5, "MD5"}, |
80 |
"MD5", |
81 |
{(void*)CRYPTO_HASH_SHA1, "SHA-1"}, |
81 |
"SHA-1", |
82 |
{(void*)CRYPTO_HASH_RIPEMD160, "RIPEMD-160"}, |
82 |
"RIPEMD-160", |
83 |
{(void*)CRYPTO_HASH_SHA512, "SHA-512"}, |
83 |
"SHA-512", |
84 |
{(void*)CRYPTO_HASH_SHA384, "SHA-384"}, |
84 |
"SHA-384", |
85 |
{(void*)CRYPTO_HASH_SHA256, "SHA-256"}, |
85 |
"SHA-256" |
86 |
}; |
86 |
}; |
87 |
|
87 |
|
88 |
const char* crypto_name(const void* tab[][2], int count, int v) { |
88 |
const char* crypto_name(const char** tab, int count, int v) { |
89 |
int i; |
89 |
if ( v < 0 || v >= count) return "Unkown"; |
90 |
for (i=0; i<count; i++) |
90 |
return tab[v]; |
91 |
if ( (int)tab[i][0] == v ) |
|
|
92 |
return (char*)(tab[i][1]); |
93 |
return "Unknown"; |
94 |
} |
91 |
} |
95 |
|
92 |
|
96 |
unsigned int crypto_name_rev(const void* tab[][2], int count, const char *str) { |
93 |
unsigned int crypto_name_rev(const char** tab, int count, const char *str) { |
97 |
int i; |
94 |
unsigned int i; |
|
|
95 |
str = &str[strspn(str," \t\n\r")]; |
98 |
for (i=0; i<count; i++) { |
96 |
for (i=0; i<count; i++) { |
99 |
str = &str[strspn(str," \t\n\r")]; |
97 |
if ( strncasecmp(tab[i], str, strlen(tab[i])) == 0 |
100 |
if ( strncasecmp((char*)tab[i][1], str, strlen((char*)tab[i][1])) == 0 |
98 |
&& strlen(str) == strlen(tab[i])) |
101 |
&& strlen(str) == strlen((char*)tab[i][1])) |
99 |
return i; |
102 |
return (int)tab[i][0]; |
|
|
103 |
} |
100 |
} |
104 |
return 0; |
101 |
return 0; |
105 |
} |
102 |
} |
|
|
103 |
|