add dutch diceware wordlist

This commit is contained in:
Mans Ziesel 2024-04-28 19:22:42 +02:00
parent 4c8d755e49
commit e694902f1a
3 changed files with 4227 additions and 3 deletions

View File

@ -36,3 +36,8 @@ Compile to Windows:
``` ```
mkdir build-windows && cd build-windows && cmake -DCMAKE_TOOLCHAIN_FILE=../mingw-toolchain.cmake .. && make mkdir build-windows && cd build-windows && cmake -DCMAKE_TOOLCHAIN_FILE=../mingw-toolchain.cmake .. && make
``` ```
Wordlists:
- https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt
- https://www.eff.org/files/2016/09/08/eff_short_wordlist_1.txt
- https://mko.re/diceware/diceware-wordlist-8k-composites-nl.txt

File diff suppressed because it is too large Load Diff

View File

@ -13,8 +13,9 @@
#include "pcg_random.hpp" #include "pcg_random.hpp"
#include "eff_large_wordlist.txt.hpp" #include "eff_large_wordlist.txt.hpp"
#include "eff_short_wordlist_1.txt.hpp" #include "eff_short_wordlist_1.txt.hpp"
#include "diceware-wordlist-8k-composites-nl.txt.hpp"
enum WordlistType { WORDLIST_EFF_LARGE, WORDLIST_EFF_SHORT, WORDLIST_CUSTOM }; enum WordlistType { WORDLIST_EFF_LARGE, WORDLIST_EFF_SHORT, WORDLIST_DUTCH, WORDLIST_CUSTOM };
struct PassgenOptions { struct PassgenOptions {
bool help = false; bool help = false;
@ -32,6 +33,9 @@ const std::unordered_map<std::string, NoArgHandle> NoArgs {
{"-h", [](PassgenOptions& s) { s.help = true; }}, {"-h", [](PassgenOptions& s) { s.help = true; }},
{"--help", [](PassgenOptions& s) { s.help = true; }}, {"--help", [](PassgenOptions& s) { s.help = true; }},
{"-nl", [](PassgenOptions& s) { s.wordlist_type = WORDLIST_DUTCH; }},
{"--dutch", [](PassgenOptions& s) { s.wordlist_type = WORDLIST_DUTCH; }},
{"-s", [](PassgenOptions& s) { s.wordlist_type = WORDLIST_EFF_SHORT; }}, {"-s", [](PassgenOptions& s) { s.wordlist_type = WORDLIST_EFF_SHORT; }},
{"--short", [](PassgenOptions& s) { s.wordlist_type = WORDLIST_EFF_SHORT; }}, {"--short", [](PassgenOptions& s) { s.wordlist_type = WORDLIST_EFF_SHORT; }},
@ -51,6 +55,9 @@ const std::unordered_map<std::string, OneArgHandle> OneArgs {
s.wordlist_path = arg; s.wordlist_path = arg;
s.wordlist_type = WORDLIST_CUSTOM; s.wordlist_type = WORDLIST_CUSTOM;
}}, }},
{"-n", [](PassgenOptions& s, const std::string& arg) {
s.wordcount = std::stoi(arg);
}},
{"-wc", [](PassgenOptions& s, const std::string& arg) { {"-wc", [](PassgenOptions& s, const std::string& arg) {
s.wordcount = std::stoi(arg); s.wordcount = std::stoi(arg);
}}, }},
@ -94,8 +101,10 @@ std::vector<std::string> getWordlist(PassgenOptions opts)
std::stringstream ss; std::stringstream ss;
if (opts.wordlist_type == WORDLIST_EFF_SHORT) { if (opts.wordlist_type == WORDLIST_EFF_SHORT) {
ss.write(reinterpret_cast<const char*>(eff_short_wordlist_1_txt), eff_short_wordlist_1_txt_len); ss.write(reinterpret_cast<const char*>(eff_short_wordlist_1_txt), eff_short_wordlist_1_txt_len);
} else { } else if (opts.wordlist_type == WORDLIST_EFF_LARGE){
ss.write(reinterpret_cast<const char*>(eff_large_wordlist_txt), eff_large_wordlist_txt_len); ss.write(reinterpret_cast<const char*>(eff_large_wordlist_txt), eff_large_wordlist_txt_len);
} else if (opts.wordlist_type == WORDLIST_DUTCH){
ss.write(reinterpret_cast<const char*>(diceware_wordlist_8k_composites_nl_txt), diceware_wordlist_8k_composites_nl_txt_len);
} }
std::string line; std::string line;
while (std::getline(ss, line)) { while (std::getline(ss, line)) {
@ -135,7 +144,7 @@ Options:
--camelcase, -cc Generate passphrase in CamelCase format --camelcase, -cc Generate passphrase in CamelCase format
-wl <path>, --wordlist <path> -wl <path>, --wordlist <path>
Use a custom wordlist file located at <path> Use a custom wordlist file located at <path>
-wc <count>, --wordcount <count> -n <count>, -wc <count>, --wordcount <count>
Amount of words to use for passphrase, default = 5 Amount of words to use for passphrase, default = 5
--separator <seperator> Specify a character to use as a separator between words, default = `-` --separator <seperator> Specify a character to use as a separator between words, default = `-`