ObjFW  OFHashes.h at [631895440e]

File src/OFHashes.h artifact 5de5b91012 part of check-in 631895440e


/*
 * Copyright (c) 2008
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import <stdint.h>

#import "OFObject.h"

#define MD5_DIGEST_SIZE	 16
#define SHA1_DIGEST_SIZE 20

@interface OFMD5Hash: OFObject
{
	uint32_t buf[4];
	uint32_t bits[2];
	uint8_t	 in[64];

	BOOL	 calculated;
}

- init;
- updateWithBuffer: (const uint8_t*)buf
	    ofSize: (size_t)size;
- (uint8_t*)digest;
@end

@interface OFSHA1Hash: OFObject
{
	uint32_t    state[5];
	uint64_t    count;
	uint8_t	    buffer[64];
	uint8_t	    digest[SHA1_DIGEST_SIZE];

	BOOL	 calculated;
}

- init;
- updateWithBuffer: (const uint8_t*)buf
	    ofSize: (size_t)size;
- (uint8_t*)digest;
@end