[U-Boot] [PATCH] Add xxhash hashing support

Wolfgang Denk wd at denx.de
Mon Mar 5 17:14:48 UTC 2018


Dear Dmitry,

In message <1520258115-29823-1-git-send-email-dunaev at tecon.ru> you wrote:
> From: Dmitry Dunaev <dunaev at tecon.ru>
> 
> ---

It would be appropriate to provide an explantion of what you are
doing here and why, which advantages it brings, what it costs (in
terms of code size), etc.

In short: please provide a proper commit message.

> +/*
> + * xxHash - Extremely Fast Hash algorithm
> + * Copyright (C) 2012-2016, Yann Collet.
> + *
> + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are
> + * met:
....
> + * This program is free software; you can redistribute it and/or modify it under
> + * the terms of the GNU General Public License version 2 as published by the
> + * Free Software Foundation. This program is dual-licensed; you may select
> + * either version 2 of the GNU General Public License ("GPL") or BSD license
> + * ("BSD").

Please use SPDX License Tags and remove the license text.

> + * Notice extracted from xxHash homepage:
> + *
> + * xxHash is an extremely fast Hash algorithm, running at RAM speed limits.
> + * It also successfully passes all tests from the SMHasher suite.
> + *
> + * Comparison (single thread, Windows Seven 32 bits, using SMHasher on a Core 2
> + * Duo @3GHz)
> + *
> + * Name            Speed       Q.Score   Author
> + * xxHash          5.4 GB/s     10
> + * CrapWow         3.2 GB/s      2       Andrew
> + * MumurHash 3a    2.7 GB/s     10       Austin Appleby
> + * SpookyHash      2.0 GB/s     10       Bob Jenkins
> + * SBox            1.4 GB/s      9       Bret Mulvey
> + * Lookup3         1.2 GB/s      9       Bob Jenkins
> + * SuperFastHash   1.2 GB/s      1       Paul Hsieh
> + * CityHash64      1.05 GB/s    10       Pike & Alakuijala
> + * FNV             0.55 GB/s     5       Fowler, Noll, Vo
> + * CRC32           0.43 GB/s     9
> + * MD5-32          0.33 GB/s    10       Ronald L. Rivest
> + * SHA1-32         0.28 GB/s    10
> + *
> + * Q.Score is a measure of quality of the hash function.
> + * It depends on successfully passing SMHasher test set.
> + * 10 is a perfect score.
> + *
> + * A 64-bits version, named xxh64 offers much better speed,
> + * but for 64-bits applications only.
> + * Name     Speed on 64 bits    Speed on 32 bits
> + * xxh64       13.8 GB/s            1.9 GB/s
> + * xxh32        6.8 GB/s            6.0 GB/s

This should probably go to the commit message.

...
> + * xxh32_wd() - calculate the 32-bit hash of the input with a given seed.
> + *              Triggering the watchdog every 'chunk_sz' bytes of input
> + *              processed.
> + *
> + * @input:    The data to hash.
> + * @length:   The length of the data to hash.
> + * @seed:     The seed can be used to alter the result predictably.
> + * @chunk_sz: The chunk size for watchdog triggering.
> + *
> + * Speed on Core 2 Duo @ 3 GHz (single thread, SMHasher benchmark) : 5.4 GB/s

Hm... what is this information good for?  How fast is it on a MPC860
at 50 MHz? How fast on a iMX28 at 400 MHz? 


> + * BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are
> + * met:

See above.  Clean up all over the place and replace with SPDX tags.

Thanks.


Wolfgang Denk

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Intel's new motto: United we stand. Divided we fall!


More information about the U-Boot mailing list