Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0005005OCamlotherlibspublic2010-03-19 10:182014-05-04 14:29
Assigned To 
PlatformOSOS Version
Product Version3.11.2 
Target VersionFixed in Version 
Summary0005005: Lowlevel interface to Digest and Bigarray support

the attached patches add a more lowlevel interface to the Digest module allowing the creation of a context and updating the context with any number of strings before finaling it to create the overall digest. It further adds a Bigarray.Array1.Digest module that allows computing the digest of an array or updating a context with an array. The more lowelevel interface allows creating a digest from e.g. a rope, which internally is a sequenze of strings.

As a special bonus the digesting of a bigarray is done with caml_enter/leave_blocking_section() and can run concurrently with other threads to take advantage of multiple cores. It might be wise to add a size check and only go into a blocking section if the array is larger than for example Page_size.

Unfortunately the same can't be done for strings as the GC can move them while being digested in a blocking section. So digesting strings can not take advantage of multiple cores.

Additional InformationThe patch is split into 2 parts. The changes to md5.c/md5.h must be applied first and the compiler must be bootstraped to get the new functions listed as primitives. Only then, in a second pass, can the remaining patch be build.
Attached Filespatch file icon 0008-md5-rewrite.patch [^] (4,436 bytes) 2010-03-19 10:18 [Show Content]
patch file icon 0009-digest-rewrite.patch [^] (6,479 bytes) 2010-03-19 10:18 [Show Content]

- Relationships

-  Notes
whitequark (developer)
2014-05-04 14:29

I have to mention that "The digests are of cryptographic quality: it is very hard, given a digest, to forge a string having that digest." is no longer true. It is trivial to forge an md5 digest, e.g. see [^]

I want to point out that improving the Digest module would invite new usage of it, whereas the right thing to do is to use SHA256 or newer hash functions from cryptokit or a similar external package.

- Issue History
Date Modified Username Field Change
2010-03-19 10:18 goswin New Issue
2010-03-19 10:18 goswin File Added: 0008-md5-rewrite.patch
2010-03-19 10:18 goswin File Added: 0009-digest-rewrite.patch
2011-06-01 17:08 doligez Status new => acknowledged
2012-06-21 20:16 frisch Category OCaml general => OCaml otherlibs
2013-09-05 11:40 doligez Tag Attached: patch
2014-05-04 14:29 whitequark Note Added: 0011342
2017-02-23 16:42 doligez Category OCaml otherlibs => otherlibs

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker