scripted-diff: Replace ParseHex[<std::byte>]("str") -> "str"_hex[_u8]

Ideally all call sites should accept std::byte instead of uint8_t but those transformations are left to future PRs.

-BEGIN VERIFY SCRIPT-
sed -i --regexp-extended 's/\bParseHex\(("[^"]*")\)/\1_hex_u8/g' $(git grep -l ParseHex -- :src ':(exclude)src/test/util_tests.cpp')
sed -i --regexp-extended 's/\bParseHex<std::byte>\(("[^"]*")\)/\1_hex/g' $(git grep -l ParseHex -- :src ':(exclude)src/test/util_tests.cpp')
sed -i --regexp-extended 's/\bScriptFromHex\(("[^"]*")\)/ToScript(\1_hex)/g' src/test/script_tests.cpp
-END VERIFY SCRIPT-

Co-Authored-By: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>
Co-Authored-By: Ryan Ofsky <ryan@ofsky.org>
This commit is contained in:
Hodlinator
2024-08-20 23:13:41 +02:00
parent 9cb687351f
commit 8756ccd712
8 changed files with 79 additions and 79 deletions

View File

@@ -832,7 +832,7 @@ BOOST_AUTO_TEST_CASE(chacha20_testvector)
BOOST_AUTO_TEST_CASE(chacha20_midblock)
{
auto key = ParseHex<std::byte>("0000000000000000000000000000000000000000000000000000000000000000");
auto key = "0000000000000000000000000000000000000000000000000000000000000000"_hex;
ChaCha20 c20{key};
// get one block of keystream
std::byte block[64];
@@ -928,7 +928,7 @@ BOOST_AUTO_TEST_CASE(poly1305_testvector)
{
// mac of the macs of messages of length 0 to 256, where the key and messages have all
// their values set to the length.
auto total_key = ParseHex<std::byte>("01020304050607fffefdfcfbfaf9ffffffffffffffffffffffffffff00000000");
auto total_key = "01020304050607fffefdfcfbfaf9ffffffffffffffffffffffffffff00000000"_hex;
Poly1305 total_ctx(total_key);
for (unsigned i = 0; i < 256; ++i) {
std::vector<std::byte> key(32, std::byte{uint8_t(i)});