Skip to content

Commit

Permalink
Removed debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
Cyclic3 committed Aug 11, 2020
1 parent 8c99ef9 commit 989feed
Show file tree
Hide file tree
Showing 3 changed files with 568 additions and 57 deletions.
4 changes: 4 additions & 0 deletions src/ciphers/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,17 @@ namespace ciphey::detail {

static inline std::vector<crack_result<Key>> crack(windowed_prob_table observed, prob_table const& expected,
freq_t count, prob_t p_value, CrackArgs const&&... args) {
if (count > 2000 && observed.size() == 29)
printf("");
std::vector<crack_result<Key>> ret;
intermediate_res_t imdt(observed.size());
// Solve as distinct substitution cyphers, in parallel
double n_candidates = 1;
for (size_t i = 0; i < observed.size(); ++i) {
n_candidates *= (imdt[i] = CrackOne(observed[i]/*std::move(observed[i])*/, expected,
std::forward<CrackArgs>(args)..., count / observed.size(), p_value)).size();
if (n_candidates == 0)
return {};
}
// This is the maximum reasonable amount before we tell someone to piss off
//
Expand Down
5 changes: 0 additions & 5 deletions src/ciphers/xor_single.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,9 @@ namespace ciphey::xor_single {
//
// TODO: actually do this with a rotation
xor_prob_table(observed, key ^ (key - 1));
if (key == 'c')
::printf("");

if (auto key_p_value = gof_test(create_assoc_table(observed, expected), count); key_p_value > p_value)
ret.push_back({.key = key, .p_value = key_p_value });
else {
::printf("");
}
}

sort_crack_result(ret);
Expand Down
Loading

0 comments on commit 989feed

Please sign in to comment.