diff options
Diffstat (limited to 'includes')
-rw-r--r-- | includes/BSHA1.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/includes/BSHA1.h b/includes/BSHA1.h index f70f6b7..55710b2 100644 --- a/includes/BSHA1.h +++ b/includes/BSHA1.h @@ -1,24 +1,21 @@ #pragma once #include <Exceptions.h> +#include <tomcrypt.h> namespace Balau { class SHA1 { public: SHA1() { reset(); } - void reset(); - void update(const uint8_t* data, const size_t len); - void final(uint8_t * digest); + void reset() { sha1_init(&m_state); } + void update(const uint8_t* data, const size_t len) { sha1_process(&m_state, data, len); } + void final(uint8_t * digest) { sha1_done(&m_state, digest); } enum { DIGEST_SIZE = 20 }; private: - void transform(uint32_t state[5], const uint8_t buffer[64]); - - uint32_t m_state[5]; - uint32_t m_count[2]; - uint8_t m_buffer[64]; + hash_state m_state; }; }; |