An advanced Ethereum/EVM mobile wallet
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
alpha-wallet-ios/Trust/EtherClient/PasswordGenerator.swift

17 lines
541 B

// Copyright SIX DAY LLC. All rights reserved.
import Foundation
import Security
struct PasswordGenerator {
static func generateRandom() -> String {
return PasswordGenerator.generateRandomString(bytesCount: 32)
}
static func generateRandomString(bytesCount: Int) -> String {
var randomBytes = [UInt8](repeating: 0, count: bytesCount)
let _ = SecRandomCopyBytes(kSecRandomDefault, bytesCount, &randomBytes)
return randomBytes.map({ String(format: "%02hhx", $0) }).joined(separator: "")
}
}