This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ { "sha256", 32, 64, silc_sha256_init, silc_sha256_update, silc_sha256_final,
+ silc_sha256_transform, silc_sha256_context_len },
{ "sha1", 20, 64, silc_sha1_init, silc_sha1_update, silc_sha1_final,
silc_sha1_transform, silc_sha1_context_len },
{ "md5", 16, 64, silc_md5_init, silc_md5_update, silc_md5_final,
{ "sha1", 20, 64, silc_sha1_init, silc_sha1_update, silc_sha1_final,
silc_sha1_transform, silc_sha1_context_len },
{ "md5", 16, 64, silc_md5_init, silc_md5_update, silc_md5_final,
/* Registers a new hash function into the SILC. This function is used at
the initialization of the SILC. */
/* Registers a new hash function into the SILC. This function is used at
the initialization of the SILC. */
while ((entry = silc_dlist_get(silc_hash_list)) != SILC_LIST_END) {
if (hash == SILC_ALL_HASH_FUNCTIONS || entry == hash) {
silc_dlist_del(silc_hash_list, entry);
while ((entry = silc_dlist_get(silc_hash_list)) != SILC_LIST_END) {
if (hash == SILC_ALL_HASH_FUNCTIONS || entry == hash) {
silc_dlist_del(silc_hash_list, entry);
The application may use this to register the default hash funcs if
specific hash funcs in any specific order is not wanted. */
The application may use this to register the default hash funcs if
specific hash funcs in any specific order is not wanted. */
*new_hash = silc_calloc(1, sizeof(**new_hash));
(*new_hash)->hash = entry;
(*new_hash)->context = silc_calloc(1, entry->context_len());
*new_hash = silc_calloc(1, sizeof(**new_hash));
(*new_hash)->hash = entry;
(*new_hash)->context = silc_calloc(1, entry->context_len());
+/* Returns the block lenght of the hash. */
+
+SilcUInt32 silc_hash_block_len(SilcHash hash)
+{
+ return hash->hash->block_len;
+}
+
+/* Returns the name of the hash function */
+
+const char *silc_hash_get_name(SilcHash hash)
+{
+ return hash->hash->name;
+}
+
while ((entry = silc_dlist_get(silc_hash_list)) != SILC_LIST_END) {
len += strlen(entry->name);
list = silc_realloc(list, len + 1);
while ((entry = silc_dlist_get(silc_hash_list)) != SILC_LIST_END) {
len += strlen(entry->name);
list = silc_realloc(list, len + 1);
entry->name, strlen(entry->name));
memcpy(list + len, ",", 1);
len++;
entry->name, strlen(entry->name));
memcpy(list + len, ",", 1);
len++;
entry = (SilcHashObject *)&(silc_default_hash[i]);
len += strlen(entry->name);
list = silc_realloc(list, len + 1);
entry = (SilcHashObject *)&(silc_default_hash[i]);
len += strlen(entry->name);
list = silc_realloc(list, len + 1);
entry->name, strlen(entry->name));
memcpy(list + len, ",", 1);
len++;
entry->name, strlen(entry->name));
memcpy(list + len, ",", 1);
len++;
+{
+ silc_hash_init(hash);
+ silc_hash_update(hash, data, len);
+ silc_hash_final(hash, return_hash);
+}
+
+void silc_hash_init(SilcHash hash)
- hash->hash->update(hash->context, (unsigned char *)data, len);
+}
+
+void silc_hash_update(SilcHash hash, const unsigned char *data,
+ SilcUInt32 data_len)
+{
+ hash->hash->update(hash->context, (unsigned char *)data, data_len);
+}
+
+void silc_hash_final(SilcHash hash, unsigned char *return_hash)
+{
+void silc_hash_transform(SilcHash hash, SilcUInt32 *state,
+ const unsigned char *data)
+{
+ hash->hash->transform(state, data);
+}
+
a = (((hval[i] >> 6) & 3) + check) % 6;
b = (hval[i] >> 2) & 15;
c = ((hval[i] & 3) + (check / 6)) % 6;
d = (hval[i + 1] >> 4) & 15;
e = hval[i + 1] & 15;
a = (((hval[i] >> 6) & 3) + check) % 6;
b = (hval[i] >> 2) & 15;
c = ((hval[i] & 3) + (check / 6)) % 6;
d = (hval[i + 1] >> 4) & 15;
e = hval[i + 1] & 15;
babbleprint[k + 0] = vo[a];
babbleprint[k + 1] = co[b];
babbleprint[k + 2] = vo[c];
babbleprint[k + 0] = vo[a];
babbleprint[k + 1] = co[b];
babbleprint[k + 2] = vo[c];
babbleprint[k + 0] = vo[a];
babbleprint[k + 1] = co[b];
babbleprint[k + 2] = vo[c];
babbleprint[k + 0] = vo[a];
babbleprint[k + 1] = co[b];
babbleprint[k + 2] = vo[c];