import std.digest.md; import std.stdio;
struct Hash { ubyte[] hash1; ubyte[] hash2; this (string str) { auto md5 = new MD5Digest(); this.hash1 = md5.digest(str); this.hash2 = digest!MD5(str); } }; void main() { auto h = Hash("hello world!"); writeln(toHexString(h.hash1)); writeln(toHexString(h.hash2)); } It's not obvious at all what the problem is.