ObjFW  Diff

Differences From Artifact [c3a8ed0de1]:

To Artifact [ab2417692f]:


29
30
31
32
33
34
35









36
37
38
39
40
41
42
 */
@protocol OFCryptoHash <OFObject, OFCopying>
/*!
 * A boolean whether the hash has already been calculated.
 */
@property (readonly, nonatomic, getter=isCalculated) bool calculated;










/*!
 * @brief Creates a new cryptographic hash.
 *
 * @return A new autoreleased OFCryptoHash
 */
+ (instancetype)cryptoHash;








>
>
>
>
>
>
>
>
>







29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
 */
@protocol OFCryptoHash <OFObject, OFCopying>
/*!
 * A boolean whether the hash has already been calculated.
 */
@property (readonly, nonatomic, getter=isCalculated) bool calculated;

/*!
 * A buffer containing the cryptographic hash.
 *
 * The size of the buffer depends on the hash used. The buffer is part of the
 * receiver's memory pool.
 */
@property (readonly, nonatomic) const unsigned char *digest
    OF_RETURNS_INNER_POINTER;

/*!
 * @brief Creates a new cryptographic hash.
 *
 * @return A new autoreleased OFCryptoHash
 */
+ (instancetype)cryptoHash;

59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 *
 * @param buffer The buffer which should be included into the calculation
 * @param length The length of the buffer
 */
- (void)updateWithBuffer: (const void *)buffer
		  length: (size_t)length;

/*!
 * @brief Returns a buffer containing the cryptographic hash.
 *
 * The size of the buffer depends on the hash used. The buffer is part of the
 * receiver's memory pool.
 *
 * @return A buffer containing the hash
 */
- (const unsigned char *)digest OF_RETURNS_INNER_POINTER;

/*!
 * @brief Resets all state so that a new hash can be calculated.
 *
 * @warning This invalidates any pointer previously returned by @ref digest. If
 *	    you are still interested in the previous digest, you need to memcpy
 *	    it yourself before calling @ref reset!
 */
- (void)reset;
@end

OF_ASSUME_NONNULL_END







<
<
<
<
<
<
<
<
<
<











68
69
70
71
72
73
74










75
76
77
78
79
80
81
82
83
84
85
 *
 * @param buffer The buffer which should be included into the calculation
 * @param length The length of the buffer
 */
- (void)updateWithBuffer: (const void *)buffer
		  length: (size_t)length;











/*!
 * @brief Resets all state so that a new hash can be calculated.
 *
 * @warning This invalidates any pointer previously returned by @ref digest. If
 *	    you are still interested in the previous digest, you need to memcpy
 *	    it yourself before calling @ref reset!
 */
- (void)reset;
@end

OF_ASSUME_NONNULL_END