This PR contains all the work related to setting up this project as required to implement the [Assignment](https://repo.rock-n-code.com/rock-n-code/deep-linking-assignment/wiki/Assignment) on top, as intended. To summarise this work: - [x] created a new **Xcode** project; - [x] cloned the `Wikipedia` app and inserted it into the **Xcode** project; - [x] created the `Locations` app and also, its `Libraries` package; - [x] created the `Shared` package to share dependencies between the apps; - [x] added a `Makefile` file and implemented some **environment** and **help** commands. Co-authored-by: Javier Cicchelli <javier@rock-n-code.com> Reviewed-on: rock-n-code/deep-linking-assignment#1
36 lines
832 B
Objective-C
36 lines
832 B
Objective-C
#import "NSString+SHA256.h"
|
|
#import <CommonCrypto/CommonCrypto.h>
|
|
|
|
@implementation NSData (SHA256)
|
|
|
|
- (NSString *)SHA256 {
|
|
CC_SHA256_CTX hashObject;
|
|
CC_SHA256_Init(&hashObject);
|
|
|
|
NSUInteger length = [self length];
|
|
const void *buffer = [self bytes];
|
|
CC_SHA256_Update(&hashObject,
|
|
(const void *)buffer,
|
|
(CC_LONG)length);
|
|
|
|
unsigned char digest[CC_SHA256_DIGEST_LENGTH];
|
|
CC_SHA256_Final(digest, &hashObject);
|
|
|
|
char hash[2 * sizeof(digest) + 1];
|
|
for (size_t i = 0; i < sizeof(digest); ++i) {
|
|
snprintf(hash + (2 * i), 3, "%02x", (int)(digest[i]));
|
|
}
|
|
|
|
return [[NSString alloc] initWithUTF8String:hash];
|
|
}
|
|
|
|
@end
|
|
|
|
@implementation NSString (SHA256)
|
|
|
|
- (NSString *)SHA256 {
|
|
return [[self dataUsingEncoding:NSUTF8StringEncoding] SHA256];
|
|
}
|
|
|
|
@end
|