Mercurial > projects > doodle
view doodle/utils/prog/md5_test.d @ 115:d7330cc52622
Added instructions to duplicates.d on the smallest changes
required to trigger/untrigger the memory blowout.
Interestingly the blowout only occurs when compiled with -m32, not -m64.
author | David Bryant <bagnose@gmail.com> |
---|---|
date | Sat, 16 Apr 2011 19:48:33 +0930 |
parents | |
children |
line wrap: on
line source
import std.md5; import std.stdio; import std.file; import std.exception; int main(in string[] args) { ulong file_count = 0; foreach (string dir; args[1..$]) { foreach (string name; dirEntries(dir, SpanMode.depth, false)) { try { ubyte[16] digest; //writefln("Doing file: %s", name); ++file_count; writef("\rFile num: %s ", file_count); auto file = File(name, "r"); scope(exit) file.close; MD5_CTX context; context.start(); foreach (ubyte[] buffer; chunks(file, 4096 * 1024)) { //bytes_chewed(buffer.length); context.update(buffer); } context.finish(digest); } catch (FileException ex) { writefln("File exception: %s", name); } catch (ErrnoException ex) { writefln("Errno exception: %s", name); } } } return 0; }