Patch 1639 use Crypto.Hash.SHA256.hashlazy in Darcs.Util.Hash

Title use Crypto.Hash.SHA256.hashlazy in Darcs.Util.Hash
Superseder Nosy List
Related Issues
Status accepted Assigned To

Created on 2018-02-08.00:42:31 by bf, last changed 2018-03-27.15:51:18 by bf.

File name Status Uploaded Type Edit Remove
suppress-import-warning-after-sha1-api-change.dpatch gh, 2018-03-21.17:42:22 application/octet-stream
use-crypto_hash_sha256_hashlazy-in-darcs_util_hash.dpatch bf, 2018-02-08.00:42:31 application/x-darcs-patch
use-crypto_hash_sha256_hashlazy-in-darcs_util_hash.dpatch gh, 2018-02-09.20:09:33 application/octet-stream
use-crypto_hash_sha256_hashlazy-in-darcs_util_hash.dpatch gh, 2018-03-15.02:36:13 application/octet-stream
See mailing list archives for discussion on individual patches.
msg19858 (view) Author: gh Date: 2018-02-08.18:57:38
Do we know why we have at the same time Darcs.Util.Hash and
Darcs.Util.Crypt.SHA256 ?
msg19865 (view) Author: gh Date: 2018-02-09.20:09:33
Answer: Darcs.Util.Hash is from the hashed-storage code which was merged
into Darcs in 2011, while  Darcs.Util.Crypt.{SHA1|SHA256} are Darcs's
earlier modules.

I'm attaching the following two cleanup patches, work in progress:

patch f7553052a1f0b396c38db7f6459ea815897de5c0
Author: Guillaume Hoffmann <guillaumh@gmail.com>
Date:   Fri Feb  9 16:44:29 -03 2018
  * move sha256sum code to Darcs.Util.Hash

patch 6547d0ca5491adc0c7e42b37b1887d528612a919
Author: Guillaume Hoffmann <guillaumh@gmail.com>
Date:   Fri Feb  9 17:02:31 -03 2018
  * move Darcs.Util.Crypt.SHA1 to Darcs.Util.SHA1

The next step would be to switch to cryptonite and remove the
Darcs.Util.SHA1 module altogether.
msg19867 (view) Author: gh Date: 2018-02-10.00:22:01
Careful that I have experienced hash failures with the whole set of
patches (yours and mine)...
msg19869 (view) Author: bf Date: 2018-02-10.15:39:09
Your last remark is a bit cryptic (pun unintentional). Could you elaborate?
msg19874 (view) Author: gh Date: 2018-02-10.19:03:16
Yes, sorry.

With a locally compiled Darcs with these 3 patches, it seemed that it
recorded a patch with an incorrect hash. After recording a patch I could
not even run "darcs log" or "darcs amend" because said patch could not
be found. The message in question was "hash failure". I had to manually
edit _darcs/hashed_inventory  and run "darcs repair" t ohavea useable

But I do not know which of the patches created the issue!
msg19971 (view) Author: gh Date: 2018-03-15.02:36:13
The culprit was me, with my first patch that incorrectly used the
'encode' function of  Codec.Binary.Base16 instead of the one of 
Data.ByteString.Base16 , which resulted in uppercase hexadecimal strings
(..89ABCD..) instead of lowercase. This is fixed, and I modified the
bundle as a single patch that moves all sha1 and sha256 functions to

The next step should be to use cryptonite. I'm screening the bundle in
the meantime.
msg20000 (view) Author: gh Date: 2018-03-22.18:38:10
msg20053 (view) Author: bf Date: 2018-03-27.15:51:18
Cool, very much appreciated from my POV.
Date User Action Args
2018-02-08 00:42:31bfcreate
2018-02-08 18:57:38ghsetmessages: + msg19858
2018-02-09 20:09:33ghsetfiles: + use-crypto_hash_sha256_hashlazy-in-darcs_util_hash.dpatch
messages: + msg19865
2018-02-10 00:22:02ghsetmessages: + msg19867
2018-02-10 15:39:09bfsetmessages: + msg19869
2018-02-10 19:03:16ghsetmessages: + msg19874
2018-03-15 02:36:13ghsetstatus: needs-screening -> needs-review
files: + use-crypto_hash_sha256_hashlazy-in-darcs_util_hash.dpatch
messages: + msg19971
2018-03-21 17:42:22ghsetfiles: + suppress-import-warning-after-sha1-api-change.dpatch
2018-03-22 18:38:10ghsetstatus: needs-review -> accepted
messages: + msg20000
2018-03-27 15:51:18bfsetmessages: + msg20053