I have a string and a key, which i want to generate an HMAC SHA256 from it. Although i\'m using 2 libs
IDZSwiftCommonCrypto and CryptoSwift
and this answer>
Not so long ago I had the same problem, so I wrote simple framework for use in Swift on all platforms - iOS macOS and tvOS
It's called EasyCrypt and you can find it here: https://github.com/lukszar/EasyCrypt
This framework let you encrypt message with your key, using HMAC algorithms. Usage is simple, like following:
let crypto = EasyCrypt(secret: "mySecretKey", algorithm: .sha256)
let result = crypto.hash("This is very secret text to encrypt")
let otherResult = crypto.hash("This is another secret text to encrypt")
print("result: ", result)
print("otherResult: ", otherResult)
You can fast install using Carthage. Inside project you can find Playground for demo usage with instructions.