The OpenD Programming Language

WrapperDigest.finish

The finish function returns the hash value. It takes an optional buffer to copy the data into. If a buffer is passed, it must have a length at least length bytes.

  1. ubyte[] finish(ubyte[] buf)
    class WrapperDigest(T)
    final nothrow
    ubyte[]
    finish
    (
    ubyte[] buf
    )
  2. ubyte[] finish()

Examples

import std.digest.md;
ubyte[16] buf;
auto hash = new WrapperDigest!MD5();
hash.put(cast(ubyte) 0);
auto result = hash.finish(buf[]);
//The result is now in result (and in buf). If you pass a buffer which is bigger than
//necessary, result will have the correct length, but buf will still have it's original
//length

Meta