Skip to content

Commit

Permalink
Output hexadecimal characters as one byte
Browse files Browse the repository at this point in the history
  • Loading branch information
kimci86 committed Oct 16, 2024
1 parent 7b4ea52 commit 73f3f79
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ try

std::cout << "You may resume the password recovery with the option: --continue-recovery ";
for (const auto c : restart)
std::cout << std::setw(2) << static_cast<int>(c);
std::cout << std::setw(2) << int{static_cast<std::uint8_t>(c)};
std::cout << std::endl;

std::cout.fill(fillBefore);
Expand All @@ -359,7 +359,7 @@ try
{
std::cout << "as bytes: ";
for (const auto c : password)
std::cout << std::setw(2) << static_cast<int>(c) << ' ';
std::cout << std::setw(2) << int{static_cast<std::uint8_t>(c)} << ' ';
std::cout << std::endl;
std::cout << "as text: " << password << std::endl;
}
Expand Down
2 changes: 1 addition & 1 deletion src/password.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class BruteforceRecovery : public SixCharactersRecovery<BruteforceRecovery>

os << "Password: " << password << " (as bytes:";
for (const auto c : password)
os << ' ' << std::setw(2) << static_cast<int>(c);
os << ' ' << std::setw(2) << int{static_cast<std::uint8_t>(c)};
os << ')' << std::endl;

os.fill(fillBefore);
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ add_test(NAME cli.bruteforce.small COMMAND bkcrack -k 9bcb20c6 10a97ca5 103c061
add_test(NAME cli.bruteforce.medium COMMAND bkcrack -k edb43a00 9ce6e179 8cf2cbba -r 10 ?a)
add_test(NAME cli.bruteforce.long COMMAND bkcrack -k dcce7593 b8a2e617 b2bd4365 -r 12 ?l)
set_tests_properties(cli.bruteforce.empty PROPERTIES PASS_REGULAR_EXPRESSION "Password: \n")
set_tests_properties(cli.bruteforce.tiny PROPERTIES PASS_REGULAR_EXPRESSION "Password: 🔐\n")
set_tests_properties(cli.bruteforce.tiny PROPERTIES PASS_REGULAR_EXPRESSION "Password: 🔐\n.*Password\nas bytes: f0 9f 94 90 \nas text: 🔐\n")
set_tests_properties(cli.bruteforce.small PROPERTIES PASS_REGULAR_EXPRESSION "Password: _S#cr3t!\n")
set_tests_properties(cli.bruteforce.medium PROPERTIES PASS_REGULAR_EXPRESSION "Password: q1w2e3r4t5\n")
set_tests_properties(cli.bruteforce.long PROPERTIES PASS_REGULAR_EXPRESSION "Password: abcdefghijkl\n")
Expand Down

0 comments on commit 73f3f79

Please sign in to comment.