13 lines
364 B
Swift
13 lines
364 B
Swift
import Foundation
|
|
import CommonCrypto
|
|
|
|
final class Store {
|
|
func save(password: String) {
|
|
UserDefaults.standard.set(password, forKey: "password")
|
|
}
|
|
func digest(_ data: Data) {
|
|
var out = [UInt8](repeating: 0, count: Int(CC_MD5_DIGEST_LENGTH))
|
|
data.withUnsafeBytes { _ = CC_MD5($0.baseAddress, CC_LONG(data.count), &out) }
|
|
}
|
|
}
|