Created
September 9, 2021 16:56
-
-
Save bergusman/f2c3cad3d1a937e5d43f648973ef496f to your computer and use it in GitHub Desktop.
Security
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var bytes = [UInt8](repeating: 0, count: 8) | |
var status = SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes) | |
if status == errSecSuccess { | |
print(bytes) | |
} else { | |
if let message = SecCopyErrorMessageString(status, nil) { | |
print("Error(\(status): \(message)") | |
} else { | |
print("Error: \(status)") | |
} | |
} | |
var bytes2: UInt64 = 0 | |
status = SecRandomCopyBytes(kSecRandomDefault, 8, &bytes2) | |
print(status, bytes2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment