From b7e1040fac3dd9782939aa1e3a99fdd1e86aefa3 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Wed, 7 Mar 2018 14:48:18 +0000 Subject: [PATCH] hashkey.[ch]: Files removed as no longer used --- include/coap/hashkey.h | 57 ------------------------------------------ src/hashkey.c | 29 --------------------- 2 files changed, 86 deletions(-) delete mode 100644 include/coap/hashkey.h delete mode 100644 src/hashkey.c diff --git a/include/coap/hashkey.h b/include/coap/hashkey.h deleted file mode 100644 index 5cff67d2..00000000 --- a/include/coap/hashkey.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * hashkey.h -- definition of hash key type and helper functions - * - * Copyright (C) 2010-2011 Olaf Bergmann - * - * This file is part of the CoAP library libcoap. Please see README for terms - * of use. - */ - -/** - * @file hashkey.h - * @brief definition of hash key type and helper functions - */ - -#ifndef _COAP_HASHKEY_H_ -#define _COAP_HASHKEY_H_ - -#include "str.h" - -typedef unsigned char coap_key_t[4]; - -#ifndef coap_hash -/** - * Calculates a fast hash over the given string @p s of length @p len and stores - * the result into @p h. Depending on the exact implementation, this function - * cannot be used as one-way function to check message integrity or simlar. - * - * @param s The string used for hash calculation. - * @param len The length of @p s. - * @param h The result buffer to store the calculated hash key. - */ -void coap_hash_impl(const unsigned char *s, unsigned int len, coap_key_t h); - -#define coap_hash(String,Length,Result) \ - coap_hash_impl((String),(Length),(Result)) - -/* This is used to control the pre-set hash-keys for resources. */ -#define __COAP_DEFAULT_HASH -#else -#undef __COAP_DEFAULT_HASH -#endif /* coap_hash */ - -/** - * Calls coap_hash() with given @c str object as parameter. - * - * @param Str Must contain a pointer to a coap string object. - * @param H A coap_key_t object to store the result. - * - * @hideinitializer - */ -#define coap_str_hash(Str,H) { \ - assert(Str); \ - memset((H), 0, sizeof(coap_key_t)); \ - coap_hash((Str)->s, (Str)->length, (H)); \ - } - -#endif /* _COAP_HASHKEY_H_ */ diff --git a/src/hashkey.c b/src/hashkey.c deleted file mode 100644 index 828b5194..00000000 --- a/src/hashkey.c +++ /dev/null @@ -1,29 +0,0 @@ -/* hashkey.c -- definition of hash key type and helper functions - * - * Copyright (C) 2010,2011 Olaf Bergmann - * - * This file is part of the CoAP library libcoap. Please see - * README for terms of use. - */ - -#include "hashkey.h" - -/* Caution: When changing this, update COAP_DEFAULT_WKC_HASHKEY - * accordingly (see int coap_hash_path()); - */ -void -coap_hash_impl(const unsigned char *s, unsigned int len, coap_key_t h) { - size_t j; - - while (len--) { - j = sizeof(coap_key_t)-1; - - while (j) { - h[j] = ((h[j] << 7) | (h[j-1] >> 1)) + h[j]; - --j; - } - - h[0] = (h[0] << 7) + h[0] + *s++; - } -} -