From af21125c404dae775c2c6b3cebbe9fb787f5c9ad Mon Sep 17 00:00:00 2001 From: iosdevzone Date: Tue, 12 Jan 2016 09:42:46 -0800 Subject: [PATCH 1/2] [GitHub #13] Missing public HMAC initializer. --- IDZSwiftCommonCrypto/HMAC.swift | 2 +- IDZSwiftCommonCryptoTestApp/AppDelegate.swift | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/IDZSwiftCommonCrypto/HMAC.swift b/IDZSwiftCommonCrypto/HMAC.swift index 0e816c1..c2d71af 100644 --- a/IDZSwiftCommonCrypto/HMAC.swift +++ b/IDZSwiftCommonCrypto/HMAC.swift @@ -129,7 +129,7 @@ public class HMAC : Updateable /// - parameter algorithm: selects the algorithm /// - parameter key: specifies the key /// - init(algorithm : Algorithm, key : String) + public init(algorithm : Algorithm, key : String) { self.algorithm = algorithm CCHmacInit(context, algorithm.nativeValue(), key, size_t(key.lengthOfBytesUsingEncoding(NSUTF8StringEncoding))) diff --git a/IDZSwiftCommonCryptoTestApp/AppDelegate.swift b/IDZSwiftCommonCryptoTestApp/AppDelegate.swift index f923d57..9e68c62 100644 --- a/IDZSwiftCommonCryptoTestApp/AppDelegate.swift +++ b/IDZSwiftCommonCryptoTestApp/AppDelegate.swift @@ -26,6 +26,10 @@ func test_StreamCryptor_AES_ECB() { //assert(byteCount == 0, "Final byte count is 0") assert(expectedCipherText.count == cipherText.count , "Counts are as expected") assert(expectedCipherText == cipherText, "Obtained expected cipher text") + + // Probing https://github.com/iosdevzone/IDZSwiftCommonCrypto/issues/13 + let hmac = HMAC(algorithm: .SHA256, key: "secret_key").update("content")?.final() ?? [] + print(hexStringFromArray(hmac)) } @UIApplicationMain From 51384628c28a3c53c6b4e19c16b6bf45805254af Mon Sep 17 00:00:00 2001 From: iosdevzone Date: Tue, 12 Jan 2016 09:43:31 -0800 Subject: [PATCH 2/2] [CocoaPods] Bumb version --- IDZSwiftCommonCrypto.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IDZSwiftCommonCrypto.podspec b/IDZSwiftCommonCrypto.podspec index a14479a..d798a34 100644 --- a/IDZSwiftCommonCrypto.podspec +++ b/IDZSwiftCommonCrypto.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "IDZSwiftCommonCrypto" - s.version = "0.7.0" + s.version = "0.7.1" s.summary = "A wrapper for Apple's Common Crypto library written in Swift." s.homepage = "https://github.com/iosdevzone/IDZSwiftCommonCrypto"