{
init();
}
-template SHA2<SHA2_256Constants>::SHA2();
-template SHA2<SHA2_512Constants>::SHA2();
+template SHA2<SHA256Constants>::SHA2();
+template SHA2<SHA512Constants>::SHA2();
template<typename C>
SHA2<C>::SHA2(const char *data, unsigned len)
init();
BlockHash<Constants::BLOCK_SIZE>::update(data, len);
}
-template SHA2<SHA2_256Constants>::SHA2(const char *, unsigned);
-template SHA2<SHA2_512Constants>::SHA2(const char *, unsigned);
+template SHA2<SHA256Constants>::SHA2(const char *, unsigned);
+template SHA2<SHA512Constants>::SHA2(const char *, unsigned);
template<typename C>
SHA2<C>::SHA2(const string &str)
init();
BlockHash<Constants::BLOCK_SIZE>::update(str);
}
-template SHA2<SHA2_256Constants>::SHA2(const string &);
-template SHA2<SHA2_512Constants>::SHA2(const string &);
+template SHA2<SHA256Constants>::SHA2(const string &);
+template SHA2<SHA512Constants>::SHA2(const string &);
template<typename C>
void SHA2<C>::init()
copy(Constants::initial, Constants::initial+8, buffer);
processed_bytes = 0;
}
-template void SHA2<SHA2_256Constants>::init();
-template void SHA2<SHA2_512Constants>::init();
+template void SHA2<SHA256Constants>::init();
+template void SHA2<SHA512Constants>::init();
template<typename C>
void SHA2<C>::process_block(const char *data)
processed_bytes += Constants::BLOCK_SIZE;
}
-template void SHA2<SHA2_256Constants>::process_block(const char *);
-template void SHA2<SHA2_512Constants>::process_block(const char *);
+template void SHA2<SHA256Constants>::process_block(const char *);
+template void SHA2<SHA512Constants>::process_block(const char *);
template<typename C>
unsigned SHA2<C>::get_digest(char *digest, unsigned len) const
return Constants::DIGEST_SIZE;
}
-template unsigned SHA2<SHA2_256Constants>::get_digest(char *, unsigned) const;
-template unsigned SHA2<SHA2_512Constants>::get_digest(char *, unsigned) const;
+template unsigned SHA2<SHA256Constants>::get_digest(char *, unsigned) const;
+template unsigned SHA2<SHA512Constants>::get_digest(char *, unsigned) const;
-const SHA2_256Constants::WordType SHA2_256Constants::initial[8] =
+const SHA256Constants::WordType SHA256Constants::initial[8] =
{
0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A, 0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19
};
-const SHA2_256Constants::WordType SHA2_256Constants::round_constants[SHA2_256Constants::N_ROUNDS] =
+const SHA256Constants::WordType SHA256Constants::round_constants[SHA256Constants::N_ROUNDS] =
{
0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5, 0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3, 0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208, 0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2
};
-const unsigned SHA2_256Constants::sigma_constants[12] =
+const unsigned SHA256Constants::sigma_constants[12] =
{
2, 13, 22, // For Σ₀
6, 11, 25, // For Σ₁
17, 19, 10 // For σ₁
};
-const SHA2_512Constants::WordType SHA2_512Constants::initial[8] =
+const SHA512Constants::WordType SHA512Constants::initial[8] =
{
0x6A09E667F3BCC908, 0xBB67AE8584CAA73B, 0x3C6EF372FE94F82B, 0xA54FF53A5F1D36F1,
0x510E527FADE682D1, 0x9B05688C2B3E6C1F, 0x1F83D9ABFB41BD6B, 0x5BE0CD19137E2179,
};
-const SHA2_512Constants::WordType SHA2_512Constants::round_constants[SHA2_512Constants::N_ROUNDS] =
+const SHA512Constants::WordType SHA512Constants::round_constants[SHA512Constants::N_ROUNDS] =
{
0x428A2F98D728AE22, 0x7137449123EF65CD, 0xB5C0FBCFEC4D3B2F, 0xE9B5DBA58189DBBC,
0x3956C25BF348B538, 0x59F111F1B605D019, 0x923F82A4AF194F9B, 0xAB1C5ED5DA6D8118,
0x28DB77F523047D84, 0x32CAAB7B40C72493, 0x3C9EBE0A15C9BEBC, 0x431D67C49C100D4C,
0x4CC5D4BECB3E42B6, 0x597F299CFC657E2A, 0x5FCB6FAB3AD6FAEC, 0x6C44198C4A475817
};
-const unsigned SHA2_512Constants::sigma_constants[12] =
+const unsigned SHA512Constants::sigma_constants[12] =
{
28, 34, 39, // For Σ₀
14, 18, 41, // For Σ₁