Function validate

Validate returns an error if the provided checksum does not match the calculated checksum of the provided data

bool validate (
  scope const(ubyte[]) data,
  scope const(ubyte[]) expected
) pure nothrow @nogc @safe;

Example

import std.string : representation;
immutable data = "123456789".representation;
immutable ubyte[2] expected = [0xC3, 0x31];
const result = checksum(data);
assert(result == expected);