The finish function returns the final hash sum and resets the Digest.
Use this to feed the digest with data. Also implements the std.range.primitives.isOutputRange interface for ubyte and const(ubyte)[]. The following usages of put must work for any type which passes isDigest:
This function is used to (re)initialize the digest. It must be called before using the digest and it also works as a 'reset' function if the digest has already processed data.
//Using the OutputRange feature import std.algorithm.mutation : copy; import std.digest.md; import std.range : repeat; auto oneMillionRange = repeat!ubyte(cast(ubyte)'a', 1000000); auto ctx = makeDigest!MD5(); copy(oneMillionRange, &ctx); //Note: You must pass a pointer to copy! assert(ctx.finish().toHexString() == "7707D6AE4E027C70EEA2A935C2296F21");
This documents the general structure of a Digest in the template API. All digest implementations should implement the following members and therefore pass the isDigest test.
Note: