/NukeDemo-Bridging-Header.h Secret
Created
April 24, 2018 12:35
Revisions
-
kean created this gist
Apr 24, 2018 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,5 @@ // // Use this file to import your target's public headers that you would like to expose to Swift. // #import "SHA1.h" This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ // The MIT License (MIT) // // Copyright (c) 2015-2018 Alexander Grebenyuk (github.com/kean). #import <Foundation/Foundation.h> /// Produces 160-bit hash value using SHA-1 algorithm. /// - returns: String containing 160-bit hash value expressed as a 40 digit /// hexadecimal number. extern NSString * _nuke_sha1(const char *data, uint32_t length); This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,20 @@ // The MIT License (MIT) // // Copyright (c) 2015-2018 Alexander Grebenyuk (github.com/kean). #import <Foundation/Foundation.h> #import <CommonCrypto/CommonCrypto.h> NSString * _nuke_sha1(const char *data, uint32_t length) { unsigned char hash[CC_SHA1_DIGEST_LENGTH]; CC_SHA1(data, (CC_LONG)length, hash); char utf8[2 * CC_SHA1_DIGEST_LENGTH + 1]; char *temp = utf8; for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) { snprintf(temp, 3, "%02x", hash[i]); temp += 2; } return [NSString stringWithUTF8String:utf8]; }