How to use CC_MD5 method in swift language

This is what I came up with. It’s an extension to String. Don’t forget to add #import <CommonCrypto/CommonCrypto.h> to the ObjC-Swift bridging header that Xcode creates. extension String { var md5: String! { let str = self.cStringUsingEncoding(NSUTF8StringEncoding) let strLen = CC_LONG(self.lengthOfBytesUsingEncoding(NSUTF8StringEncoding)) let digestLen = Int(CC_MD5_DIGEST_LENGTH) let result = UnsafeMutablePointer<CUnsignedChar>.alloc(digestLen) CC_MD5(str!, strLen, result) let hash = … Read more

MD5 to String Convert Logic [closed]

There is not a way to “decrypt” md5 to it’s original string, as it is a one way hashing algorithm. Imagine you taking a small video maybe 100MB big, and making an MD5 hash out of it, how in the world would you get that back from a 32 Byte string? Or in your case … Read more