blob: b4c921dc1890e346dd3ad3454be44136ad57f975 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
/*
* Copyright (c) 2022, stelar7 <dudedbz@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/ByteBuffer.h>
namespace Crypto::Authentication {
struct State {
u32 r[4] {};
u32 s[4] {};
u64 a[8] {};
u8 blocks[17] {};
u8 block_count {};
};
class Poly1305 {
public:
explicit Poly1305(ReadonlyBytes key);
void update(ReadonlyBytes message);
ErrorOr<ByteBuffer> digest();
private:
void process_block();
State m_state;
};
}
|