1
2
3
4
5
6
7
8
9
10
11
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019
* Jonathan Schleifer <js@heap.zone>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
|
|
|
1
2
3
4
5
6
7
8
9
10
11
|
/*
* Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017,
* 2018, 2019, 2020
* Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
87
88
|
@property (readonly, nonatomic) size_t digestSize;
/*!
* @brief The block size of the cryptographic hash, in bytes.
*/
@property (readonly, nonatomic) size_t blockSize;
/*!
* @brief A boolean whether the hash has already been calculated.
*/
@property (readonly, nonatomic, getter=isCalculated) bool calculated;
/*!
* @brief 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;
/*!
* @brief Returns the digest size of the cryptographic hash, in bytes.
*
* @return The digest size of the cryptographic hash, in bytes
*/
+ (size_t)digestSize;
/*!
* @brief Returns the block size of the cryptographic hash, in bytes.
*
* @return The block size of the cryptographic hash, in bytes
*/
+ (size_t)blockSize;
/*!
* @brief Adds a buffer to the cryptographic hash to be calculated.
*
* @param buffer The buffer which should be included into the calculation
* @param length The length of the buffer
*/
- (void)updateWithBuffer: (const void *)buffer
|
>
>
>
>
>
|
|
>
>
>
>
>
>
>
>
>
>
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
@property (readonly, nonatomic) size_t digestSize;
/*!
* @brief The block size of the cryptographic hash, in bytes.
*/
@property (readonly, nonatomic) size_t blockSize;
/*!
* @brief Whether data may be stored in swappable memory.
*/
@property (readonly, nonatomic) bool allowsSwappableMemory;
/*!
* @brief A boolean whether the hash has already been calculated.
*/
@property (readonly, nonatomic, getter=isCalculated) bool calculated;
/*!
* @brief 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 cryptographic hash
*/
+ (instancetype)cryptoHashWithAllowsSwappableMemory:
(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;
/*!
* @brief Returns the block size of the cryptographic hash, in bytes.
*
* @return The block size of the cryptographic hash, in bytes
*/
+ (size_t)blockSize;
/*!
* @brief Initializes an already allocated cryptographic hash.
*
* @return An initialized cryptographic hash
*/
- (instancetype)initWithAllowsSwappableMemory: (bool)allowsSwappableMemory;
- (instancetype)init OF_UNAVAILABLE;
/*!
* @brief Adds a buffer to the cryptographic hash to be calculated.
*
* @param buffer The buffer which should be included into the calculation
* @param length The length of the buffer
*/
- (void)updateWithBuffer: (const void *)buffer
|