forked from scrod/nv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
NSData_transformations.h
executable file
·49 lines (36 loc) · 1.5 KB
/
NSData_transformations.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
/*
* You need to have the OpenSSL header files (as well as the location of their
* include directory given to Project Builder) for this to compile. For it
* to link, add /usr/lib/libcrypto.dylib and /usr/lib/libssl.dylib to the linked
* frameworks.
*/
/* NSData_crypto.h */
#import <Foundation/Foundation.h>
#include <openssl/evp.h>
@interface NSData (NVUtilities)
- (NSMutableData *) compressedData;
- (NSMutableData *) compressedDataAtLevel:(int)level;
- (NSMutableData *) uncompressedData;
- (BOOL) isCompressedFormat;
+ (NSMutableData *)randomDataOfLength:(int)len;
- (NSMutableData*)derivedKeyOfLength:(int)len salt:(NSData*)salt iterations:(int)count;
- (unsigned long)CRC32;
- (NSData*)SHA1Digest;
- (NSData*)MD5Digest;
- (NSData*)BrokenMD5Digest;
- (NSString*)pathURLFromWebArchive;
- (BOOL)fsRefAsAlias:(FSRef*)fsRef;
+ (NSData*)aliasDataForFSRef:(FSRef*)fsRef;
- (NSMutableString*)newStringUsingBOMReturningEncoding:(NSStringEncoding*)encoding;
+ (NSData*)uncachedDataFromFile:(NSString*)filename;
- (NSString *)encodeBase64;
- (NSString *)encodeBase64WithNewlines:(BOOL)encodeWithNewlines;
@end
@interface NSMutableData (NVCryptoRelated)
- (void)reverseBytes;
- (void)alignForBlockSize:(int)alignedBlockSize;
- (BOOL)encryptAESDataWithKey:(NSData*)key iv:(NSData*)iv;
- (BOOL)decryptAESDataWithKey:(NSData*)key iv:(NSData*)iv;
- (BOOL)encryptDataWithCipher:(const EVP_CIPHER*)cipher key:(NSData*)key iv:(NSData*)iv;
- (BOOL)decryptDataWithCipher:(const EVP_CIPHER*)cipher key:(NSData*)key iv:(NSData*)iv;
@end