ObjFW  Check-in [6a3c47863d]

Overview
Comment:OFSHA*Hash: Minor cleanup
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6a3c47863de36f0f3ffa69d51aafd73b155f59cb0c8bc3fdfff8c46fedd1ba8e
User & Date: js on 2015-11-02 19:27:41
Other Links: manifest | tags
Context
2015-11-02
21:49
Add +[OFSystemInfo supportsAltiVec] check-in: 2ba8ec1bf1 user: js tags: trunk
19:27
OFSHA*Hash: Minor cleanup check-in: 6a3c47863d user: js tags: trunk
15:07
OFDate: Use wcsftime on Windows check-in: b8fc41bf18 user: js tags: trunk
Changes

Modified src/OFSHA224Hash.m from [6f53e35d7d] to [97dde27e1d].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

@implementation OFSHA224Hash
+ (size_t)digestSize
{
	return 28;
}

- init
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)OF_resetState
{
	_state[0] = 0xC1059ED8;
	_state[1] = 0x367CD507;
	_state[2] = 0x3070DD17;
	_state[3] = 0xF70E5939;
	_state[4] = 0xFFC00B31;
	_state[5] = 0x68581511;
	_state[6] = 0x64F98FA7;
	_state[7] = 0xBEFA4FA4;
}
@end







<
<
<
<
<
<
<
<
<












20
21
22
23
24
25
26









27
28
29
30
31
32
33
34
35
36
37
38

@implementation OFSHA224Hash
+ (size_t)digestSize
{
	return 28;
}










- (void)OF_resetState
{
	_state[0] = 0xC1059ED8;
	_state[1] = 0x367CD507;
	_state[2] = 0x3070DD17;
	_state[3] = 0xF70E5939;
	_state[4] = 0xFFC00B31;
	_state[5] = 0x68581511;
	_state[6] = 0x64F98FA7;
	_state[7] = 0xBEFA4FA4;
}
@end

Modified src/OFSHA224Or256Hash.m from [1adbe2ccf4] to [d23742f855].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <stdlib.h>
#include <string.h>

#import "OFSHA224Or256Hash.h"

#import "OFHashAlreadyCalculatedException.h"

static const uint32_t table[] = {







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"


#include <string.h>

#import "OFSHA224Or256Hash.h"

#import "OFHashAlreadyCalculatedException.h"

static const uint32_t table[] = {
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
+ (instancetype)hash
{
	return [[[self alloc] init] autorelease];
}

- init
{
	if (object_getClass(self) == [OFSHA224Or256Hash class]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
		} @catch (id e) {
			[self release];
			@throw e;
		}

		abort();
	}

	return [super init];
}

- (void)updateWithBuffer: (const void*)buffer_
		  length: (size_t)length
{
	const uint8_t *buffer = buffer_;








<
<
<
<
|
<
|
|
<
|
<
|







123
124
125
126
127
128
129




130

131
132

133

134
135
136
137
138
139
140
141
+ (instancetype)hash
{
	return [[[self alloc] init] autorelease];
}

- init
{




	self = [super init];


	[self OF_resetState];



	return self;
}

- (void)updateWithBuffer: (const void*)buffer_
		  length: (size_t)length
{
	const uint8_t *buffer = buffer_;

Modified src/OFSHA256Hash.m from [3137857ab3] to [beef36a624].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

@implementation OFSHA256Hash
+ (size_t)digestSize
{
	return 32;
}

- init
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)OF_resetState
{
	_state[0] = 0x6A09E667;
	_state[1] = 0xBB67AE85;
	_state[2] = 0x3C6EF372;
	_state[3] = 0xA54FF53A;
	_state[4] = 0x510E527F;
	_state[5] = 0x9B05688C;
	_state[6] = 0x1F83D9AB;
	_state[7] = 0x5BE0CD19;
}
@end







<
<
<
<
<
<
<
<
<












20
21
22
23
24
25
26









27
28
29
30
31
32
33
34
35
36
37
38

@implementation OFSHA256Hash
+ (size_t)digestSize
{
	return 32;
}










- (void)OF_resetState
{
	_state[0] = 0x6A09E667;
	_state[1] = 0xBB67AE85;
	_state[2] = 0x3C6EF372;
	_state[3] = 0xA54FF53A;
	_state[4] = 0x510E527F;
	_state[5] = 0x9B05688C;
	_state[6] = 0x1F83D9AB;
	_state[7] = 0x5BE0CD19;
}
@end

Modified src/OFSHA384Hash.m from [6d0c49039d] to [e62fd485f5].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

@implementation OFSHA384Hash
+ (size_t)digestSize
{
	return 48;
}

- init
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)OF_resetState
{
	_state[0] = 0xCBBB9D5DC1059ED8;
	_state[1] = 0x629A292A367CD507;
	_state[2] = 0x9159015A3070DD17;
	_state[3] = 0x152FECD8F70E5939;
	_state[4] = 0x67332667FFC00B31;
	_state[5] = 0x8EB44A8768581511;
	_state[6] = 0xDB0C2E0D64F98FA7;
	_state[7] = 0x47B5481DBEFA4FA4;
}
@end







<
<
<
<
<
<
<
<
<












20
21
22
23
24
25
26









27
28
29
30
31
32
33
34
35
36
37
38

@implementation OFSHA384Hash
+ (size_t)digestSize
{
	return 48;
}










- (void)OF_resetState
{
	_state[0] = 0xCBBB9D5DC1059ED8;
	_state[1] = 0x629A292A367CD507;
	_state[2] = 0x9159015A3070DD17;
	_state[3] = 0x152FECD8F70E5939;
	_state[4] = 0x67332667FFC00B31;
	_state[5] = 0x8EB44A8768581511;
	_state[6] = 0xDB0C2E0D64F98FA7;
	_state[7] = 0x47B5481DBEFA4FA4;
}
@end

Modified src/OFSHA384Or512Hash.m from [139ebf49f1] to [aff18d378f].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <stdlib.h>
#include <string.h>

#import "OFSHA384Or512Hash.h"

#import "OFHashAlreadyCalculatedException.h"

static const uint64_t table[] = {







<







12
13
14
15
16
17
18

19
20
21
22
23
24
25
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"


#include <string.h>

#import "OFSHA384Or512Hash.h"

#import "OFHashAlreadyCalculatedException.h"

static const uint64_t table[] = {
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
+ (instancetype)hash
{
	return [[[self alloc] init] autorelease];
}

- init
{
	if (object_getClass(self) == [OFSHA384Or512Hash class]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
		} @catch (id e) {
			[self release];
			@throw e;
		}

		abort();
	}

	return [super init];
}

- (void)updateWithBuffer: (const void*)buffer_
		  length: (size_t)length
{
	const uint8_t *buffer = buffer_;








<
<
<
<
|
<
|
|
<
|
<
|







134
135
136
137
138
139
140




141

142
143

144

145
146
147
148
149
150
151
152
+ (instancetype)hash
{
	return [[[self alloc] init] autorelease];
}

- init
{




	self = [super init];


	[self OF_resetState];



	return self;
}

- (void)updateWithBuffer: (const void*)buffer_
		  length: (size_t)length
{
	const uint8_t *buffer = buffer_;

Modified src/OFSHA512Hash.m from [e761d41b46] to [88e8083bbb].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47

@implementation OFSHA512Hash
+ (size_t)digestSize
{
	return 64;
}

- init
{
	self = [super init];

	[self OF_resetState];

	return self;
}

- (void)OF_resetState
{
	_state[0] = 0x6A09E667F3BCC908;
	_state[1] = 0xBB67AE8584CAA73B;
	_state[2] = 0x3C6EF372FE94F82B;
	_state[3] = 0xA54FF53A5F1D36F1;
	_state[4] = 0x510E527FADE682D1;
	_state[5] = 0x9B05688C2B3E6C1F;
	_state[6] = 0x1F83D9ABFB41BD6B;
	_state[7] = 0x5BE0CD19137E2179;
}
@end







<
<
<
<
<
<
<
<
<












20
21
22
23
24
25
26









27
28
29
30
31
32
33
34
35
36
37
38

@implementation OFSHA512Hash
+ (size_t)digestSize
{
	return 64;
}










- (void)OF_resetState
{
	_state[0] = 0x6A09E667F3BCC908;
	_state[1] = 0xBB67AE8584CAA73B;
	_state[2] = 0x3C6EF372FE94F82B;
	_state[3] = 0xA54FF53A5F1D36F1;
	_state[4] = 0x510E527FADE682D1;
	_state[5] = 0x9B05688C2B3E6C1F;
	_state[6] = 0x1F83D9ABFB41BD6B;
	_state[7] = 0x5BE0CD19137E2179;
}
@end