43 lines
973 B
C++
43 lines
973 B
C++
/***
|
|
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
|
|
|
|
File: AuHashStream.hpp
|
|
Date: 2021-6-12
|
|
Author: Reece
|
|
***/
|
|
#pragma once
|
|
|
|
namespace Aurora::Hashing
|
|
{
|
|
#pragma pack(push)
|
|
#pragma pack(4)
|
|
struct HashStreamImpl : IHashStream
|
|
{
|
|
HashStreamImpl(EHashType type);
|
|
|
|
void Ingest(const Memory::MemoryViewRead &input) override;
|
|
|
|
AuUInt8 const *GetBytes(AuUInt32 &length) override;
|
|
|
|
Memory::MemoryViewRead Finalize() override;
|
|
Memory::MemoryViewRead PeekFinalize() override;
|
|
|
|
AuResult<Memory::MemoryViewRead> Export() override;
|
|
|
|
bool Import(const Memory::MemoryViewRead &view) override;
|
|
|
|
void Reset() override;
|
|
|
|
void Init();
|
|
private:
|
|
EHashType type_ {};
|
|
bool bFinished_ {};
|
|
AuUInt8 buffer_[64] {};
|
|
union
|
|
{
|
|
hash_state state_ {};
|
|
char altBuffer_[432];
|
|
};
|
|
};
|
|
#pragma pack(pop)
|
|
} |