forked from jerrykrinock/ClassesObjC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSSYDigester.h
63 lines (52 loc) · 1.54 KB
/
SSYDigester.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#import <Cocoa/Cocoa.h>
#include <openssl/evp.h>
enum SSYDigesterAlgorithm_enum {
SSYDigesterAlgorithmMd5,
SSYDigesterAlgorithmSha1
} ;
typedef enum SSYDigesterAlgorithm_enum SSYDigesterAlgorithm ;
/*!
@brief A class for computing message digests incrementally.
@details
*/
@interface SSYDigester : NSObject {
EVP_MD_CTX m_context ;
}
/*!
@brief Initializes a new message digest with a given
algorithm type.
*/
- (id)initWithAlgorithm:(SSYDigesterAlgorithm)algorithm ;
/*!
@brief Incrementally updates the message digest to
account for additional given data.
*/
- (void)updateWithData:(NSData*)data ;
/*!
@brief Incrementally updates the message digest to
account for an additional given string which is first
converted to a C string with a given encoding.
@details The NULL terminator on the C string *is*
included in the additional data.
@param encoding The string encoding to be used to
convert the given string to data. Must be one of the
following:
* NSUTF8StringEncoding
* NSASCIIStringEncoding
* NSUnicodeStringEncoding
* NSUTF16StringEncoding
* NSUTF16BigEndianStringEncoding
* NSUTF16LittleEndianStringEncoding
*/
- (void)updateWithString:(NSString*)string
encoding:(NSStringEncoding)encoding ;
/*!
@brief Returns the final message digest.
@details After sending this message to the receiver,
you should release/deallocate it. Sending a
further message to the receiver afer sending -finalize
for the first time will result in an assertion being
raised.
*/
- (NSData*)finalizeDigest ;
@end