From 9754372d5e4125bf5850d9cd3ae93d529efdef8d Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Sat, 21 Dec 2013 18:32:27 -0800 Subject: Preliminary WebSocket protocol support. --- includes/SHA1.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 includes/SHA1.h (limited to 'includes/SHA1.h') diff --git a/includes/SHA1.h b/includes/SHA1.h new file mode 100644 index 0000000..f70f6b7 --- /dev/null +++ b/includes/SHA1.h @@ -0,0 +1,24 @@ +#pragma once + +#include + +namespace Balau { + +class SHA1 { + public: + SHA1() { reset(); } + void reset(); + void update(const uint8_t* data, const size_t len); + void final(uint8_t * 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]; +}; + +}; -- cgit v1.2.3