[RFC] Drop md5sum, crc32 and sha1 cmds in favor of hash cmd
Tom Rini
trini at konsulko.com
Wed Feb 7 14:48:13 CET 2024
On Wed, Feb 07, 2024 at 02:00:16PM +0100, Igor Opaniuk wrote:
> 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!
It would be good, implementation wise, if each of those commands was
just a redirect to hash ..., similar to how "load ...." will call the
right filesystem calls. Does that make sense? Thanks.
--
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20240207/91159fe5/attachment.sig>
More information about the U-Boot
mailing list