diff --git a/test/constant_time/dudect_test.cpp b/test/constant_time/dudect_test.cpp index 12d57d0..ce5d702 100644 --- a/test/constant_time/dudect_test.cpp +++ b/test/constant_time/dudect_test.cpp @@ -23,7 +23,8 @@ // 1 also at the third to eighth places of the 7 groups before it, drawn at random), the verdict // invalid_padding in both; bech32's decode of the 61 characters // of 32 bytes under "bc" into a secure::secret<32> (class 0 the text of zeros, class 1 the text of -// random bytes, both valid, encoded unmeasured), the same text through the secret stream decoder, +// random bytes, both valid, encoded unmeasured by the constant-time conversion of a +// secure::secret<32>), the same text through the secret stream decoder, // bech32's encode of a secure::secret<32> (class 0 zeros, class 1 random), and the decode of an // invalid text whose one character outside the alphabet lies where a class puts it (class 0 the // first of the data, class 1 anywhere in it), invalid_character in both; base58's secret decode of @@ -626,11 +627,19 @@ int main(int argc, char** argv) { measure_base32_cases(results, *selection); // bech32 decode: the text of 32 zero bytes under "bc", against the text of random bytes, each - // encoded unmeasured: the same length, both valid. + // encoded unmeasured: the same length, both valid. Each text is encoded by the constant-time + // conversion of a secure::secret<32>, as base58's are. With the public conversion of the + // public bytes, bech32_stream_decode read |t| over 10 on AMD EPYC 9V74 runners in 23 of 56 + // processes (up to 122; seven runners, eight processes each, 2026-12-03), and at least as often + // with the stream decoder changed to write its data apart from its hold (54 of 56) or not to + // wipe it (32 of 56): the decode is not where the classes differ. With this preparation it read + // 1 to 4 in all 56. codecs#2's run had read 132 and 104 there. auto const bech32_part = formats::bech32("bc"); std::array bech32_text{}; + secure::secret<32> bech32_key; auto const encode_bech32_text = [&](std::array const& bytes) { - static_cast(codecs::encode(bech32_part, bytes, std::span{bech32_text})); + std::ranges::copy(bytes, bech32_key.writable().begin()); + static_cast(codecs::encode(bech32_part, bech32_key, std::span{bech32_text})); }; measure_with_control( results, *selection, "bech32_decode",