ObjFW  Check-in [275744ecd3]

Overview
Comment:Add +[digestSize] and +[blockSize] to OFHash.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 275744ecd3965e62d581689dfa150dce8669ae8ab0e29e9aa34fc990f79c95e7
User & Date: js on 2011-02-17 19:56:26
Other Links: manifest | tags
Context
2011-02-19
13:14
of_asprintf: Use format even if object is nil. check-in: 5fdaa5b909 user: js tags: trunk
2011-02-17
19:56
Add +[digestSize] and +[blockSize] to OFHash. check-in: 275744ecd3 user: js tags: trunk
18:29
Add -[stringWithContentsOfURL:encoding:]. check-in: d932adccc3 user: js tags: trunk
Changes

Modified src/OFHash.h from [0b81448598] to [537a82b073].

24
25
26
27
28
29
30










31
32
33
34
35
36
37
	BOOL	 isCalculated;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) BOOL isCalculated;
#endif











/**
 * Adds a buffer to the hash to be calculated.
 *
 * \param buf The buffer which should be included into the calculation.
 * \param size The size of the buffer
 */
- (void)updateWithBuffer: (const char*)buf







>
>
>
>
>
>
>
>
>
>







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
	BOOL	 isCalculated;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly) BOOL isCalculated;
#endif

/**
 * \return The digest size of the hash, in byte.
 */
+ (size_t)digestSize;

/**
 * \return The block size of the hash, in byte.
 */
+ (size_t)blockSize;

/**
 * Adds a buffer to the hash to be calculated.
 *
 * \param buf The buffer which should be included into the calculation.
 * \param size The size of the buffer
 */
- (void)updateWithBuffer: (const char*)buf

Modified src/OFHash.m from [8a4a684c1b] to [e129568799].

16
17
18
19
20
21
22












23
24
25
26
27
28
29

#include "config.h"

#import "OFHash.h"
#import "OFExceptions.h"

@implementation OFHash












- (void)updateWithBuffer: (const char*)buffer
		  ofSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}








>
>
>
>
>
>
>
>
>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

#include "config.h"

#import "OFHash.h"
#import "OFExceptions.h"

@implementation OFHash
+ (size_t)digestSize
{
	@throw [OFNotImplementedException newWithClass: self
					      selector: _cmd];
}

+ (size_t)blockSize
{
	@throw [OFNotImplementedException newWithClass: self
					      selector: _cmd];
}

- (void)updateWithBuffer: (const char*)buffer
		  ofSize: (size_t)size
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

Modified src/OFMD5Hash.m from [62560185fb] to [f05769188c].

117
118
119
120
121
122
123










124
125
126
127
128
129
130
}

@implementation OFMD5Hash
+ MD5Hash
{
	return [[[self alloc] init] autorelease];
}











- init
{
	self = [super init];

	buf[0] = 0x67452301;
	buf[1] = 0xEFCDAB89;







>
>
>
>
>
>
>
>
>
>







117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
}

@implementation OFMD5Hash
+ MD5Hash
{
	return [[[self alloc] init] autorelease];
}

+ (size_t)digestSize
{
	return 16;
}

+ (size_t)blockSize
{
	return 64;
}

- init
{
	self = [super init];

	buf[0] = 0x67452301;
	buf[1] = 0xEFCDAB89;

Modified src/OFSHA1Hash.m from [b9d1ebe958] to [ba33b42a53].

129
130
131
132
133
134
135










136
137
138
139
140
141
142
}

@implementation OFSHA1Hash
+ SHA1Hash
{
	return [[[self alloc] init] autorelease];
}











- init
{
	self = [super init];

	state[0] = 0x67452301;
	state[1] = 0xEFCDAB89;







>
>
>
>
>
>
>
>
>
>







129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
}

@implementation OFSHA1Hash
+ SHA1Hash
{
	return [[[self alloc] init] autorelease];
}

+ (size_t)digestSize
{
	return 20;
}

+ (size_t)blockSize
{
	return 64;
}

- init
{
	self = [super init];

	state[0] = 0x67452301;
	state[1] = 0xEFCDAB89;