1. Resolve the compilation failure in ProxSpace by specifying the version number of mingw-w64-ucrt-x86_64-arm-none-eabi-binutils.
2. Once msys2 resolves the issue, remove the specified version number to allow the latest version to be installed.
The magic card notes listed "No implemented commands" for USCUID-UL,
but hf_mfu_uscuid.py and hf_mf_uscuid_prog.lua both drive these cards
(config, type, UID, signature, backdoor read/write). Document both
scripts and how to set the tag signature, and correct the script name
shown in the lua script's own usage text.
Second, independent cause of missing pre-images. Where the previous commit
addressed the modulo forks, this one addresses check().
ck() rewrites a repeated value as the *index* it matched:
ck(i, j, z) = ck(i, j-1, z[i] <- j) if z[i] == z[j]
so a stored value in 0..3 is ambiguous: it may be such a marker, or a genuine
small value. reverse_ck() committed to one reading, and walked j in the same
descending order as the forward pass, so it could not undo a chained
substitution:
half 01 03 24 03
ck() 01 03 24 00 03 matched z[1] -> 1, then 1 matched z[0] -> 0
reverse_ck() 01 03 24 01 restores z[0]=01 at j=0, never revisits j=1
8.9% of random four-value halves failed the ck() round-trip. Most of the time
that still landed on a different but valid pre-image, since hash0 is
many-to-one, which is why the visible symptom was intermittent: usually a
missing pre-image, occasionally none at all.
Fix. ck() reduces to, for i = 3, 2, 1 in that order:
v = z[i]; for j = i-1 down to 0: if (v == z[j]) v = j; out[i] = v;
where every z[j] on the right is still the original value, because z[j] is only
rewritten once j becomes the outer index, which happens later. So out[i]
depends solely on the original z[i] and z[0..i-1], and a half can be inverted
index by index: z[0] is known, then z[1], and so on, undoing each step in
reverse and branching wherever both readings are possible. The halves are
independent, so the result is their cross product.
reverse_ck()/reverse_check() are replaced by invert_ck_index(),
invert_ck_half() and reverse_check_all(), which return every candidate rather
than one. invert_hash0() now iterates them. Candidates are still validated
through hash0() before being reported, so nothing invalid can be emitted.
Verified by round-tripping random pre-images through hash0() and invert_hash0():
before after
recovered 82.55% 100.000%
keys with no output 1108 0
pre-images per key max 32, avg 4.2 max 128, avg 6.0
over 500,000 keys. Every emitted pre-image was additionally checked to hash
back to the input key; none failed. The output now matches an independent
exhaustive sweep of the pre-image space on every key tested.