summaryrefslogtreecommitdiff
path: root/louloulibs
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-09-28 20:14:41 +0200
committerlouiz’ <louiz@louiz.org>2016-09-28 20:14:41 +0200
commit985da8f2b2fbd2119a15e88677ab23c0f74f4100 (patch)
tree294cb8d8a27c1ed016893f4f427e0ca29ea4c88e /louloulibs
parentdaa7ea04a447d4c67a225eb116c0befc2866ea66 (diff)
downloadbiboumi-985da8f2b2fbd2119a15e88677ab23c0f74f4100.tar.gz
biboumi-985da8f2b2fbd2119a15e88677ab23c0f74f4100.tar.bz2
biboumi-985da8f2b2fbd2119a15e88677ab23c0f74f4100.tar.xz
biboumi-985da8f2b2fbd2119a15e88677ab23c0f74f4100.zip
Remove unused code in sha1 module
Diffstat (limited to 'louloulibs')
-rw-r--r--louloulibs/utils/sha1.cpp33
-rw-r--r--louloulibs/utils/sha1.hpp2
2 files changed, 0 insertions, 35 deletions
diff --git a/louloulibs/utils/sha1.cpp b/louloulibs/utils/sha1.cpp
index 76476df..f75bc2a 100644
--- a/louloulibs/utils/sha1.cpp
+++ b/louloulibs/utils/sha1.cpp
@@ -119,36 +119,3 @@ uint8_t* sha1_result(sha1nfo *s) {
// Return pointer to hash (20 characters)
return s->state.b;
}
-
-#define HMAC_IPAD 0x36
-#define HMAC_OPAD 0x5c
-
-void sha1_initHmac(sha1nfo *s, const uint8_t* key, int keyLength) {
- uint8_t i;
- memset(s->keyBuffer, 0, BLOCK_LENGTH);
- if (keyLength > BLOCK_LENGTH) {
- // Hash long keys
- sha1_init(s);
- for (;keyLength--;) sha1_writebyte(s, *key++);
- memcpy(s->keyBuffer, sha1_result(s), HASH_LENGTH);
- } else {
- // Block length keys are used as is
- memcpy(s->keyBuffer, key, keyLength);
- }
- // Start inner hash
- sha1_init(s);
- for (i=0; i<BLOCK_LENGTH; i++) {
- sha1_writebyte(s, s->keyBuffer[i] ^ HMAC_IPAD);
- }
-}
-
-uint8_t* sha1_resultHmac(sha1nfo *s) {
- uint8_t i;
- // Complete inner hash
- memcpy(s->innerHash,sha1_result(s),HASH_LENGTH);
- // Calculate outer hash
- sha1_init(s);
- for (i=0; i<BLOCK_LENGTH; i++) sha1_writebyte(s, s->keyBuffer[i] ^ HMAC_OPAD);
- for (i=0; i<HASH_LENGTH; i++) sha1_writebyte(s, s->innerHash[i]);
- return sha1_result(s);
-}
diff --git a/louloulibs/utils/sha1.hpp b/louloulibs/utils/sha1.hpp
index d02de75..d436782 100644
--- a/louloulibs/utils/sha1.hpp
+++ b/louloulibs/utils/sha1.hpp
@@ -31,5 +31,3 @@ void sha1_init(sha1nfo *s);
void sha1_writebyte(sha1nfo *s, uint8_t data);
void sha1_write(sha1nfo *s, const char *data, size_t len);
uint8_t* sha1_result(sha1nfo *s);
-void sha1_initHmac(sha1nfo *s, const uint8_t* key, int keyLength);
-uint8_t* sha1_resultHmac(sha1nfo *s);