ObjFW  Diff

Differences From Artifact [eb798114fa]:

To Artifact [3e39e62dc1]:


14
15
16
17
18
19
20
21


22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
14
15
16
17
18
19
20

21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
37







-
+
+







-
+







 */

#import "OFObject.h"

OF_ASSUME_NONNULL_BEGIN

/**
 * @protocol OFCryptoHash OFCryptoHash.h ObjFW/OFCryptoHash.h
 * @protocol OFCryptographicHash \
 *	     OFCryptographicHash.h ObjFW/OFCryptographicHash.h
 *
 * @brief A protocol for classes providing cryptographic hash functions.
 *
 * A cryptographic hash implementing this protocol can be copied. The entire
 * state is copied, allowing to calculate a new hash from there. This is
 * especially useful for generating many hashes with a common prefix.
 */
@protocol OFCryptoHash <OFObject, OFCopying>
@protocol OFCryptographicHash <OFObject, OFCopying>
#ifdef OF_HAVE_CLASS_PROPERTIES
@property (class, readonly, nonatomic) size_t digestSize;
@property (class, readonly, nonatomic) size_t blockSize;
#endif

/**
 * @brief The digest size of the cryptographic hash, in bytes.
62
63
64
65
66
67
68
69
70

71
72
73
74
75
76
77
63
64
65
66
67
68
69


70
71
72
73
74
75
76
77







-
-
+







    OF_RETURNS_INNER_POINTER;

/**
 * @brief Creates a new cryptographic hash.
 *
 * @return A new autoreleased cryptographic hash
 */
+ (instancetype)cryptoHashWithAllowsSwappableMemory:
    (bool)allowsSwappableMemory;
+ (instancetype)hashWithAllowsSwappableMemory: (bool)allowsSwappableMemory;

/**
 * @brief Returns the digest size of the cryptographic hash, in bytes.
 *
 * @return The digest size of the cryptographic hash, in bytes
 */
+ (size_t)digestSize;