00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #import "OFObject.h"
00013 #import "OFString.h"
00014
00015 #define OF_MD5_DIGEST_SIZE 16
00016 #define OF_SHA1_DIGEST_SIZE 20
00017
00018 extern int _OFHashing_reference;
00019
00023 @interface OFMD5Hash: OFObject
00024 {
00025 uint32_t buf[4];
00026 uint32_t bits[2];
00027 uint8_t in[64];
00028
00029 BOOL calculated;
00030 }
00031
00035 + md5Hash;
00036
00043 - updateWithBuffer: (const char*)buf
00044 ofSize: (size_t)size;
00045
00050 - (uint8_t*)digest;
00051 @end
00052
00056 @interface OFSHA1Hash: OFObject
00057 {
00058 uint32_t state[5];
00059 uint64_t count;
00060 char buffer[64];
00061 uint8_t digest[OF_SHA1_DIGEST_SIZE];
00062
00063 BOOL calculated;
00064 }
00065
00069 + sha1Hash;
00070
00077 - updateWithBuffer: (const char*)buf
00078 ofSize: (size_t)size;
00079
00084 - (uint8_t*)digest;
00085 @end
00086
00091 @interface OFString (OFHashing)
00095 - (OFString*)md5Hash;
00096
00100 - (OFString*)sha1Hash;
00101 @end