[RFC] Drop md5sum, crc32 and sha1 cmds in favor of hash cmd

Igor Opaniuk igor.opaniuk at gmail.com
Wed Feb 7 14:00:16 CET 2024


Hello,

I was playing a bit with different hash functions recently, and
it turned out that md5sum, crc32, sha1 cmds just duplicate
what is already covered by generic `hash` cmd.

=> sha1 0x60000000 0x200
sha1 for 60000000 ... 600001ff ==> 4ff5ffc91d00a95155518b920f46e2483d0e1437
=> hash sha1 0x60000000 0x200
sha1 for 60000000 ... 600001ff ==> 4ff5ffc91d00a95155518b920f46e2483d0e1437

=> crc32 0x60000000 0x200
crc32 for 60000000 ... 600001ff ==> 6fe352e8
=> hash crc32 0x60000000 0x200
crc32 for 60000000 ... 600001ff ==> 6fe352e8

=> md5sum 0x60000000 0x200
md5 for 60000000 ... 600001ff ==> e6bbbe95f5b41996f4a9b9af7bbd4050
=> hash md5 0x60000000 0x200
md5 for 60000000 ... 600001ff ==> e6bbbe95f5b41996f4a9b9af7bbd4050

Considering that most of them (besides md5sum) are using the same
int hash_command() function under the hood, but have a lot of duplicated
code for handling params, does it make sense to do some cleanup and
drop all them in favour  `hash`?

I also plan to extend usage info for `hash` by adding a list
compiled-in algos based on hash related compiled flags
(CONFIG_SHA1, CONFIG_CRC32 etc), so it's clear what algos
are available for hash calculation.

Comments/objections are welcome!

Regards,
Igor

-- 
Best regards - Freundliche Grüsse - Meilleures salutations

Igor Opaniuk

mailto: igor.opaniuk at gmail.com
skype: igor.opanyuk
+48 666 108 041
http://ua.linkedin.com/in/iopaniuk


More information about the U-Boot mailing list