mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-17 05:41:29 +02:00
13 lines
300 B
Swift
13 lines
300 B
Swift
import Foundation
|
|
|
|
func secRandom(count: Int) -> Data? {
|
|
var bytes = [Int8](repeating: 0, count: count)
|
|
let status = SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes)
|
|
|
|
if status == errSecSuccess {
|
|
return Data(bytes: bytes, count: bytes.count)
|
|
}
|
|
|
|
return nil
|
|
}
|