v / vlib / hash / hash.v
24 lines · 21 sloc · 491 bytes · 258aed44fe8a44b3aae00fdae22d32c00947e4b3
Raw
1// Copyright (c) 2019-2024 Alexander Medvednikov. All rights reserved.
2// Use of this source code is governed by an MIT license
3// that can be found in the LICENSE file.
4module hash
5
6pub interface Hash {
7mut:
8 // Sum appends the current hash to b and returns the resulting array.
9 // It does not change the underlying hash state.
10 sum(b []u8) []u8
11 size() int
12 block_size() int
13 free()
14 reset()
15 write(p []u8) !int
16}
17
18interface Hash32er {
19 sum32() u32
20}
21
22interface Hash64er {
23 sum64() u64
24}
25