hash: use new view casting api
This commit is contained in:
parent
2b8b733bfd
commit
974f5a50e7
@ -26,7 +26,7 @@ using cruft::crypto::hash::HOTP;
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
HOTP::HOTP (util::view<const char*> _key, uint64_t _counter):
|
HOTP::HOTP (util::view<const char*> _key, uint64_t _counter):
|
||||||
m_counter (_counter),
|
m_counter (_counter),
|
||||||
m_hash (_key.template cast<const uint8_t> ())
|
m_hash (_key.template cast<const uint8_t*> ())
|
||||||
{ ; }
|
{ ; }
|
||||||
|
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ main (int, char **) {
|
|||||||
|
|
||||||
const MD2 h;
|
const MD2 h;
|
||||||
for (const auto &i: TESTS) {
|
for (const auto &i: TESTS) {
|
||||||
if (h (util::view{i.input}.cast<const uint8_t> ()) != i.output) {
|
if (h (util::view{i.input}.cast<const uint8_t*> ()) != i.output) {
|
||||||
std::cerr << "Failed on " << i.input << "\n";
|
std::cerr << "Failed on " << i.input << "\n";
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ main (int, char**) {
|
|||||||
|
|
||||||
MD4 h;
|
MD4 h;
|
||||||
for (auto i: TESTS) {
|
for (auto i: TESTS) {
|
||||||
if (h (util::view{i.input}.cast <const uint8_t> ()) != i.output) {
|
if (h (util::view{i.input}.cast <const uint8_t*> ()) != i.output) {
|
||||||
std::cerr << "Failed on '" << i.input << "'\n";
|
std::cerr << "Failed on '" << i.input << "'\n";
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ main (int, char **) {
|
|||||||
|
|
||||||
for (const auto &i: TESTS) {
|
for (const auto &i: TESTS) {
|
||||||
SHA256 obj;
|
SHA256 obj;
|
||||||
tap.expect_eq (obj (util::view{i.input}.cast<const uint8_t> ()), i.output, "%s", i.msg);
|
tap.expect_eq (obj (util::view{i.input}.cast<const uint8_t*> ()), i.output, "%s", i.msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tap.status ();
|
return tap.status ();
|
||||||
|
Loading…
Reference in New Issue
Block a user