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

LibCrypto: Add support for the POSIX cksum algorithm

This commit is contained in:
implicitfield 2024-01-17 21:15:25 +04:00 committed by Ali Mohammad Pur
parent 459fa8b840
commit 05ee5ffa36
4 changed files with 150 additions and 0 deletions

View file

@ -0,0 +1,31 @@
/*
* Copyright (c) 2024, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Span.h>
#include <AK/Types.h>
#include <LibCrypto/Checksum/ChecksumFunction.h>
namespace Crypto::Checksum {
class cksum : public ChecksumFunction<u32> {
public:
cksum() = default;
cksum(ReadonlyBytes data)
{
update(data);
}
virtual void update(ReadonlyBytes data) override;
virtual u32 digest() override;
private:
u32 m_state { 0 };
off_t m_size { 0 };
};
}