mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:27:46 +00:00
LibCrypto: Make Digest
s able to return bytes
This commit is contained in:
parent
3f0e425f1e
commit
22efc34ec5
3 changed files with 10 additions and 2 deletions
|
@ -73,6 +73,13 @@ struct MultiHashDigestVariant {
|
|||
[&](const auto& value) { return value.data_length(); });
|
||||
}
|
||||
|
||||
[[nodiscard]] ReadonlyBytes bytes() const
|
||||
{
|
||||
return m_digest.visit(
|
||||
[&](const Empty&) -> ReadonlyBytes { VERIFY_NOT_REACHED(); },
|
||||
[&](const auto& value) { return value.bytes(); });
|
||||
}
|
||||
|
||||
using DigestVariant = Variant<Empty, MD5::DigestType, SHA1::DigestType, SHA256::DigestType, SHA384::DigestType, SHA512::DigestType>;
|
||||
DigestVariant m_digest {};
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue