ObjFW
Loading...
Searching...
No Matches
OFCryptographicHash.h
1/*
2 * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3 *
4 * All rights reserved.
5 *
6 * This file is part of ObjFW. It may be distributed under the terms of the
7 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8 * the packaging of this file.
9 *
10 * Alternatively, it may be distributed under the terms of the GNU General
11 * Public License, either version 2 or 3, which can be found in the file
12 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13 * file.
14 */
15
16#import "OFObject.h"
17
18OF_ASSUME_NONNULL_BEGIN
19
30@protocol OFCryptographicHash <OFObject, OFCopying>
31#ifdef OF_HAVE_CLASS_PROPERTIES
32@property (class, readonly, nonatomic) size_t digestSize;
33@property (class, readonly, nonatomic) size_t blockSize;
34#endif
35
39@property (readonly, nonatomic) size_t digestSize;
40
44@property (readonly, nonatomic) size_t blockSize;
45
49@property (readonly, nonatomic) bool allowsSwappableMemory;
50
54@property (readonly, nonatomic, getter=isCalculated) bool calculated;
55
64@property (readonly, nonatomic) const unsigned char *digest
65 OF_RETURNS_INNER_POINTER;
66
72+ (instancetype)hashWithAllowsSwappableMemory: (bool)allowsSwappableMemory;
73
79+ (size_t)digestSize;
80
86+ (size_t)blockSize;
87
93- (instancetype)initWithAllowsSwappableMemory: (bool)allowsSwappableMemory;
94
95- (instancetype)init OF_UNAVAILABLE;
96
104- (void)updateWithBuffer: (const void *)buffer length: (size_t)length;
105
111- (void)calculate;
112
120- (void)reset;
121@end
122
123OF_ASSUME_NONNULL_END
The root class for all other classes inside ObjFW.
Definition OFObject.h:688