mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-02-09 17:25:04 +00:00
This required multiple changes: - Make hashes non-copiable because they contain a heap allocated pointer - Reference classes via `NonnullOwnPtr` only (they are non-copiable) - Drop all existing hashes implementations - Use the `OpenSSLHashFunction` base class to implement the same hashes I was not able to come up with a way to divide this commit into multiple without increasing the amount of changes. Nothing breaks with this commit!
30 lines
531 B
C++
30 lines
531 B
C++
/*
|
|
* Copyright (c) 2020, Ali Mohammad Pur <mpfard@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <AK/ByteString.h>
|
|
#include <LibCrypto/Hash/OpenSSLHashFunction.h>
|
|
|
|
namespace Crypto::Hash {
|
|
|
|
class SHA1 final : public OpenSSLHashFunction<SHA1, 512, 160> {
|
|
AK_MAKE_NONCOPYABLE(SHA1);
|
|
|
|
public:
|
|
explicit SHA1(EVP_MD_CTX* context)
|
|
: OpenSSLHashFunction(EVP_sha1(), context)
|
|
{
|
|
}
|
|
|
|
virtual ByteString class_name() const override
|
|
{
|
|
return "SHA1";
|
|
}
|
|
};
|
|
|
|
}
|