diff --git a/hash/sha2.cpp b/hash/sha2.cpp index 88385165..d1067702 100644 --- a/hash/sha2.cpp +++ b/hash/sha2.cpp @@ -156,7 +156,7 @@ uint64_t H_512[] = { }; /////////////////////////////////////////////////////////////////////////////// -SHA2::SHA2 (): +SHA256::SHA256 (): m_total (0) { std::copy (std::begin (H_256), std::end (H_256), std::begin (H)); @@ -164,7 +164,7 @@ SHA2::SHA2 (): void -SHA2::update (const uint8_t *data, size_t length) { +SHA256::update (const uint8_t *data, size_t length) { while (length) { size_t buffered = m_total % sizeof (M); size_t chunk = std::min (sizeof (M) - buffered, length); @@ -180,7 +180,7 @@ SHA2::update (const uint8_t *data, size_t length) { void -SHA2::finish (void) { +SHA256::finish (void) { // Append a single 1 bit followed by 0s. size_t buffered = m_total % sizeof (M); size_t used = m_total * 8; @@ -219,7 +219,7 @@ SHA2::finish (void) { void -SHA2::process (void) { +SHA256::process (void) { CHECK_EQ (m_total % sizeof (M), 0); // Initialise the message schedule, W @@ -264,8 +264,8 @@ SHA2::process (void) { } -SHA2::digest_t -SHA2::digest (void) const { +SHA256::digest_t +SHA256::digest (void) const { digest_t out; auto cursor = out.begin (); diff --git a/hash/sha2.hpp b/hash/sha2.hpp index a0edb1c4..d5ce2327 100644 --- a/hash/sha2.hpp +++ b/hash/sha2.hpp @@ -16,12 +16,12 @@ namespace util { namespace hash { - class SHA2 { + class SHA256 { public: typedef std::array digest_t; public: - SHA2(); + SHA256(); void update (const uint8_t *, size_t); void finish (void); diff --git a/test/sha2.cpp b/test/sha2.cpp index ff9518d3..8c94f56c 100644 --- a/test/sha2.cpp +++ b/test/sha2.cpp @@ -4,11 +4,11 @@ #include -using util::hash::SHA2; +using util::hash::SHA256; static const struct { const char *input; - SHA2::digest_t output; + SHA256::digest_t output; } TESTS[] = { { "", { 0xE3, 0xB0, 0xC4, 0x42, 0x98, 0xFC, 0x1C, 0x14, 0x9A, 0xFB, 0xF4, 0xC8, 0x99, 0x6F, 0xB9, 0x24, @@ -40,7 +40,7 @@ static const struct { int main (int, char **) { for (auto i: TESTS) { - SHA2 obj; + SHA256 obj; obj.update (reinterpret_cast (i.input), strlen (i.input)); obj.finish ();