AuroraRuntime/Include/Aurora/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

53 lines
1.4 KiB
C++

/***
Copyright (C) 2021 J Reece Wilson (a/k/a "Reece"). All rights reserved.
File: HashStream.hpp
Date: 2021-6-10
Author: Reece
***/
#pragma once
namespace Aurora::Hashing
{
struct IHashStream
{
/**
* @brief Processes an arbitrary amount of bytes
* @param input
*/
virtual void Ingest(const Memory::MemoryViewRead &input) = 0;
/**
* @brief Legacy pointer variant of the ::Finalize API. Wont deprecate.
* @param length
* @return
*/
virtual AuUInt8 const* GetBytes(AuUInt32 &length) = 0;
/**
* @brief Finalizes the stream - locks and returns the internal buffer
* @return
*/
virtual Memory::MemoryViewRead Finalize() = 0;
/**
* @brief Exports the state of an aligned stream
* @return
*/
virtual AuResult<Memory::MemoryViewRead> Export() = 0;
/**
* @brief Starts off from where ::Export left off
* @param view
* @return
*/
virtual bool Import(const Memory::MemoryViewRead &view) = 0;
/**
* @brief Reuse the IHashStream of the EHashType variant by resetting the stream state to its' default configuration
*/
virtual void Reset() = 0;
};
AUKN_SHARED_API(HashStream, IHashStream, EHashType type);
}