From c34ceec5a2dbf00ff257e1e1364fa4432da305bc Mon Sep 17 00:00:00 2001 From: belajarqywok Date: Sat, 31 Dec 2022 17:09:50 +0700 Subject: [PATCH] pswdgn all commit --- include/generator.h | 35 ++++++++++++++++++----------------- pswdgn.cpp | 14 +++++++------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/include/generator.h b/include/generator.h index 3731bac..62bd9f2 100644 --- a/include/generator.h +++ b/include/generator.h @@ -9,23 +9,23 @@ class Generator { public : - void key (int lengthKey, bool numberOnlyOption) { + void key (int lengthKey, bool numberOnlyOption) { - std::string result = ""; + std::string result = ""; - std::string numberCharacters = "1234567890"; - std::string lowerCharacters = "abcdefghijklmnopqrstuvwxyz"; - std::string upperCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - std::string allCharacters = ( + std::string numberCharacters = "1234567890"; + std::string lowerCharacters = "abcdefghijklmnopqrstuvwxyz"; + std::string upperCharacters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + std::string allCharacters = ( - lowerCharacters + - numberCharacters + - upperCharacters - ); + lowerCharacters + + numberCharacters + + upperCharacters + ); srand ( - time(0) - ); + time(0) + ); if ( numberOnlyOption ) { @@ -33,8 +33,8 @@ class Generator { result += numberCharacters [ - rand() % numberCharacters.length() - ]; + rand() % numberCharacters.length() + ]; } @@ -44,13 +44,14 @@ class Generator { result += allCharacters [ - rand() % allCharacters.length() - ]; + rand() % allCharacters.length() + ]; } + } - std::cout << result << std::endl; + std::cout << result << std::endl; } }; diff --git a/pswdgn.cpp b/pswdgn.cpp index a0b829d..696a91c 100644 --- a/pswdgn.cpp +++ b/pswdgn.cpp @@ -8,20 +8,20 @@ int main (int argc, char** argv) { if( (strcmp(argv[1], "-l") == 0) || (strcmp(argv[1], "--length") == 0) ) { - if( (strcmp(argv[3], "-on") == 0) || (strcmp(argv[3], "--only-number") == 0) ) { + if ( (strcmp(argv[3], "-on") == 0) || (strcmp(argv[3], "--only-number") == 0) ) { gen.key( - std::atoi(argv[2]), true - ); + std::atoi(argv[2]), true + ); - }else if( (strcmp(argv[3], "-a") == 0) || (strcmp(argv[3], "--all") == 0) ){ + } else if ( (strcmp(argv[3], "-a") == 0) || (strcmp(argv[3], "--all") == 0) ){ gen.key( - std::atoi(argv[2]), false - ); + std::atoi(argv[2]), false + ); } @@ -32,7 +32,7 @@ int main (int argc, char** argv) { } - return 0; + return 0; }