ObjFW  Diff

Differences From Artifact [d2aa9374f1]:

To Artifact [5648aee5dd]:


8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "OFObject.h"
#import "OFString.h"

#define MD5_DIGEST_SIZE	 16
#define SHA1_DIGEST_SIZE 20

extern int _OFHashing_reference;

/**
 * The OFMD5Hash class provides functions to create an MD5 hash.
 */
@interface OFMD5Hash: OFObject







|
|







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "OFObject.h"
#import "OFString.h"

#define OF_MD5_DIGEST_SIZE  16
#define OF_SHA1_DIGEST_SIZE 20

extern int _OFHashing_reference;

/**
 * The OFMD5Hash class provides functions to create an MD5 hash.
 */
@interface OFMD5Hash: OFObject
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
 * \param buf The buffer which should be included into calculation.
 * \param size The size of the buffer
 */
- updateWithBuffer: (const char*)buf
	    ofSize: (size_t)size;

/**
 * \return A buffer containing the hash (MD5_DIGEST_SIZE = 16 bytes).
 *	   The buffer is part of object's memory pool.
 */
- (uint8_t*)digest;
@end

/**
 * The OFSHA1Hash class provides functions to create an SHA1 hash.
 */
@interface OFSHA1Hash: OFObject
{
	uint32_t state[5];
	uint64_t count;
	char	 buffer[64];
	uint8_t	 digest[SHA1_DIGEST_SIZE];

	BOOL	 calculated;
}

/**
 * \return A new autoreleased SHA1 Hash
 */







|













|







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
 * \param buf The buffer which should be included into calculation.
 * \param size The size of the buffer
 */
- updateWithBuffer: (const char*)buf
	    ofSize: (size_t)size;

/**
 * \return A buffer containing the hash (OF_MD5_DIGEST_SIZE = 16 bytes).
 *	   The buffer is part of object's memory pool.
 */
- (uint8_t*)digest;
@end

/**
 * The OFSHA1Hash class provides functions to create an SHA1 hash.
 */
@interface OFSHA1Hash: OFObject
{
	uint32_t state[5];
	uint64_t count;
	char	 buffer[64];
	uint8_t	 digest[OF_SHA1_DIGEST_SIZE];

	BOOL	 calculated;
}

/**
 * \return A new autoreleased SHA1 Hash
 */
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 * \param buf The buffer which should be included into calculation.
 * \param size The size of the buffer
 */
- updateWithBuffer: (const char*)buf
	    ofSize: (size_t)size;

/**
 * \return A buffer containing the hash (SHA1_DIGEST_SIZE = 20 bytes).
 *	   The buffer is part of object's memory pool.
 */
- (uint8_t*)digest;
@end

/**
 * The OFString (OFHashing) category provides methods to calculate hashes for







|







78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
 * \param buf The buffer which should be included into calculation.
 * \param size The size of the buffer
 */
- updateWithBuffer: (const char*)buf
	    ofSize: (size_t)size;

/**
 * \return A buffer containing the hash (OF_SHA1_DIGEST_SIZE = 20 bytes).
 *	   The buffer is part of object's memory pool.
 */
- (uint8_t*)digest;
@end

/**
 * The OFString (OFHashing) category provides methods to calculate hashes for