1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:17:35 +00:00

LibCrypto: Implement HMAC

This commit is contained in:
AnotherTest 2020-04-08 01:54:50 +04:30 committed by Andreas Kling
parent 4f89a377a4
commit f2cd004d11
8 changed files with 249 additions and 3 deletions

View file

@ -26,6 +26,8 @@
#pragma once
#include <AK/String.h>
#include <AK/StringBuilder.h>
#include <LibCrypto/Cipher/Mode/Mode.h>
namespace Crypto {
@ -40,6 +42,14 @@ namespace Cipher {
{
}
virtual String class_name() const override
{
StringBuilder builder;
builder.append(this->cipher().class_name());
builder.append("_CBC");
return builder.build();
}
virtual Optional<ByteBuffer> encrypt(const ByteBuffer& in, ByteBuffer& out, Optional<ByteBuffer> ivec = {}) override
{
auto length = in.size();

View file

@ -50,6 +50,8 @@ namespace Cipher {
return ByteBuffer::create_uninitialized(input_size + T::block_size() - remainder);
}
virtual String class_name() const = 0;
protected:
T& cipher() { return m_cipher; }