AuroraRuntime/Source/Hashing/HashStream.hpp
Reece d0c4d8cb33 Hash API polish
[+] Added IHashStream::Export
[+] Added IHashStream::Import
[+] Added IHashStream::Finalize (versus "deprecated" older api)
[+] Added EHashType eMD4, eRMD128, eRMD160, eRMD256, eRMD320
2022-05-14 21:06:46 +01:00

35 lines
780 B
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: HashStream.hpp
Date: 2021-6-12
Author: Reece
***/
#pragma once
namespace Aurora::Hashing
{
struct HashStream : IHashStream
{
HashStream(EHashType type);
void Ingest(const Memory::MemoryViewRead &input) override;
AuUInt8 const *GetBytes(AuUInt32 &length) override;
Memory::MemoryViewRead Finalize() override;
AuResult<Memory::MemoryViewRead> Export() override;
bool Import(const Memory::MemoryViewRead &view) override;
void Reset() override;
void Init();
private:
AuUInt8 buffer_[64] {};
hash_state state_ {};
EHashType type_ {};
bool finished_ {};
};
}