On Sun, 29 Nov 2020 15:00:38 +0200 Joonas Kylmälä <joonas.kylm...@iki.fi> wrote:
> Any idea why are we not just checking st.st_size == MD5_DIGEST_LENGTH > ? If we don't check that the data that exists on the file is not the > same length then we end up just comparing the first MD5_DIGEST_LENGTH > / 16 bytes. Good question: I didn't look at that when working on that patch. It's because the md5 is stored as text inside the nv_data.bin.md5 > $ cat nv_data.bin.md5 ; echo > 90e82ca32a48369b33f6f64955443fa9 > $ file nv_data.bin.md5 > nv_data.bin.md5: ASCII text, with no line terminators So each characters takes 8 bit (ASCII). So with that nv_data.bin.md5 takes 32 bytes: > $ ls -l nv_data.bin.md5 > -rw-r--r-- 1 gnutoo gnutoo 32 11 sept. 04:01 nv_data.bin.md5 If you were to encode that directly in binary, each "character" would take only 4 bits: > $ hexdump -C nv_data.bin.md5.bin > 00000000 90 e8 2c a3 2a 48 36 9b 33 f6 f6 49 55 44 3f a9 |..,.*H6.3..IUD?.| > 00000010 $ ls -l nv_data.bin.md5.bin -rw-r--r-- 1 gnutoo gnutoo 16 1 déc. 12:30 nv_data.bin.md5.bin Denis.
pgpuFDXAWM6Bt.pgp
Description: OpenPGP digital signature
_______________________________________________ Replicant mailing list Replicant@osuosl.org https://lists.osuosl.org/mailman/listinfo/replicant