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 OFHash: OFObject
00024 {
00025 BOOL calculated;
00026 }
00027
00028 #ifdef OF_HAVE_PROPERTIES
00029 @property (readonly) BOOL calculated;
00030 #endif
00031
00038 - (void)updateWithBuffer: (const char*)buf
00039 ofSize: (size_t)size;
00040
00045 - (uint8_t*)digest;
00046
00050 - (BOOL)calculated;
00051 @end
00052
00056 @interface OFMD5Hash: OFHash
00057 {
00058 uint32_t buf[4];
00059 uint32_t bits[2];
00060 uint8_t in[64];
00061 }
00062
00066 + md5Hash;
00067 @end
00068
00072 @interface OFSHA1Hash: OFHash
00073 {
00074 uint32_t state[5];
00075 uint64_t count;
00076 char buffer[64];
00077 uint8_t digest[OF_SHA1_DIGEST_SIZE];
00078 }
00079
00083 + sha1Hash;
00084 @end
00085
00090 @interface OFString (OFHashing)
00094 - (OFString*)md5Hash;
00095
00099 - (OFString*)sha1Hash;
00100 @end