summaryrefslogtreecommitdiff
path: root/includes/SHA1.h
diff options
context:
space:
mode:
authorNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-12-21 18:32:27 -0800
committerNicolas "Pixel" Noble <pixel@nobis-crew.org>2013-12-21 18:32:27 -0800
commit9754372d5e4125bf5850d9cd3ae93d529efdef8d (patch)
treefc20e375256b95bbd13fecde0d85181100a198e4 /includes/SHA1.h
parent9697add8b75b96662c8d39477e58d5841c4b9cba (diff)
Preliminary WebSocket protocol support.
Diffstat (limited to 'includes/SHA1.h')
-rw-r--r--includes/SHA1.h24
1 files changed, 24 insertions, 0 deletions
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 <Exceptions.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);
+
+ 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];
+};
+
+};