Skip to content

Instantly share code, notes, and snippets.

View choncou's full-sized avatar
🚀
💻 🌍

Unathi Chonco choncou

🚀
💻 🌍
View GitHub Profile
@jernejstrasner
jernejstrasner / HMACDigest.swift
Last active May 4, 2020 14:54
HMAC digest in Swift
// Make sure you add #import <CommonCrypto/CommonCrypto.h> to the Xcode bridging header!
enum CryptoAlgorithm {
case MD5, SHA1, SHA224, SHA256, SHA384, SHA512
var HMACAlgorithm: CCHmacAlgorithm {
var result: Int = 0
switch self {
case .MD5: result = kCCHmacAlgMD5
case .SHA1: result = kCCHmacAlgSHA1