diff options
Diffstat (limited to 'include/llvm/Support/SHA1.h')
-rw-r--r-- | include/llvm/Support/SHA1.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/llvm/Support/SHA1.h b/include/llvm/Support/SHA1.h index 8347a713f272..1fc60a878f94 100644 --- a/include/llvm/Support/SHA1.h +++ b/include/llvm/Support/SHA1.h @@ -18,6 +18,7 @@ #include "llvm/ADT/ArrayRef.h" +#include <array> #include <cstdint> namespace llvm { @@ -53,6 +54,9 @@ public: /// made into update. StringRef result(); + /// Returns a raw 160-bit SHA1 hash for the given data. + static std::array<uint8_t, 20> hash(ArrayRef<uint8_t> Data); + private: /// Define some constants. /// "static constexpr" would be cleaner but MSVC does not support it yet. @@ -61,7 +65,10 @@ private: // Internal State struct { - uint32_t Buffer[BLOCK_LENGTH / 4]; + union { + uint8_t C[BLOCK_LENGTH]; + uint32_t L[BLOCK_LENGTH / 4]; + } Buffer; uint32_t State[HASH_LENGTH / 4]; uint32_t ByteCount; uint8_t BufferOffset; |