We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f0a2a2a + 339e6a1 commit 2e216c2Copy full SHA for 2e216c2
ios/RCTAes/lib/AesCrypt.m
@@ -14,10 +14,12 @@
14
@implementation AesCrypt
15
16
+ (NSString *) toHex:(NSData *)nsdata {
17
- NSString * hexStr = [NSString stringWithFormat:@"%@", nsdata];
18
- for(NSString * toRemove in [NSArray arrayWithObjects:@"<", @">", @" ", nil])
19
- hexStr = [hexStr stringByReplacingOccurrencesOfString:toRemove withString:@""];
20
- return hexStr;
+ const unsigned char *bytes = (const unsigned char *)nsdata.bytes;
+ NSMutableString *hex = [NSMutableString new];
+ for (NSInteger i = 0; i < nsdata.length; i++) {
+ [hex appendFormat:@"%02x", bytes[i]];
21
+ }
22
+ return [hex copy];
23
}
24
25
+ (NSData *) fromHex: (NSString *)string {
0 commit comments