AuroraRuntime/Include/Aurora/Hashing/HashStream.hpp
Jamie Reece Wilson 3732352b4e [+] AuHashing::Whirlpool
[+] AuHashing::Blake2S_32
[+] AuHashing::Blake2S_28
[+] AuHashing::Blake2S_20
[+] AuHashing::Blake2S_16
[+] AuHashing::Blake2B_64
[+] AuHashing::Blake2B_48
[+] AuHashing::Blake2B_32
[+] AuHashing::Blake2B_20
[+] AuHashing::GetHashLength
[+] AuHashing::GetHashBits
[+] AuHashing::IHashStream::GetHashType
2024-02-18 17:53:37 +00:00

69 lines
1.9 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
{
static const auto kSizeHashStream = 512ul;
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 &uLength) = 0;
/**
* @brief Finalizes the stream - locks and returns the internal buffer
* @return
*/
virtual Memory::MemoryViewRead Finalize() = 0;
/**
* @brief 1) Temporarily finalizes the stream
* 2) Copies the final state into the final buffer
* 3) Returns the stream its' original state
* 4) Returns a view of the final buffer
* @return
*/
virtual Memory::MemoryViewRead PeekFinalize() = 0;
/**
* @brief Exports the state of an aligned stream
* @warning This method assumes you're dealing with block aligned streams
* @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;
virtual EHashType GetHashType() = 0;
};
AUKN_SHARED_SOO2(HashStream, IHashStream, kSizeHashStream,
((EHashType,type)),
EHashType type);
}