Add eff short wordlist
This commit is contained in:
parent
5e4fbaec8a
commit
610eef411f
6 changed files with 1326 additions and 5 deletions
6
passKit/Assets.xcassets/Wordlist/Contents.json
Normal file
6
passKit/Assets.xcassets/Wordlist/Contents.json
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
},
|
||||
"data" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "eff_long_wordlist.txt"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
"data" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"filename" : "EN_wordlist.txt",
|
||||
"filename" : "eff_short_wordlist.txt",
|
||||
"universal-type-identifier" : "public.plain-text"
|
||||
}
|
||||
]
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -58,11 +58,18 @@ public enum PasswordGeneratorFlavor: String {
|
|||
private static func generateXKCD(length: Int) -> String {
|
||||
// Get the word list
|
||||
let bundle = Bundle(identifier: Globals.passKitBundleIdentifier)!
|
||||
guard let asset = NSDataAsset(name: "WordLists", bundle: bundle),
|
||||
let wordlistNames = [
|
||||
"eff_long_wordlist",
|
||||
"eff_short_wordlist"
|
||||
]
|
||||
let data = wordlistNames.map{ name -> String in
|
||||
guard let asset = NSDataAsset(name: name, bundle: bundle),
|
||||
let data = String(data: asset.data, encoding: .utf8) else {
|
||||
return ""
|
||||
}
|
||||
let words = data.splitByNewline()
|
||||
return data
|
||||
}
|
||||
let words = data.joined(separator: "\n").splitByNewline()
|
||||
|
||||
// Generate a password
|
||||
let delimiters = "0123456789!@#$%^&*_+-="
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue