[Issue 21560] md5 poor performance out of the box

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 20 17:58:34 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21560

--- Comment #2 from Witold Baryluk <witold.baryluk+d at gmail.com> ---
void main(string[] args) {
  import std.digest.md : MD5, toHexString;
  import std.digest : LetterCase;
  import std.stdio : File, writefln;

  foreach (filename; args[1..$]) {
    ubyte[32768] buffer_ = void;
    MD5 md5;
    md5.start();
    foreach (ubyte[] buffer; File(filename).byChunk(buffer_)) {
        md5.put(buffer);
    }
    auto hash = md5.finish();
    writefln!("%s  %s")(toHexString!(LetterCase.lower)(hash), filename);
  }
}

--


More information about the Digitalmars-d-bugs mailing list