View source code
Display the source code in std/digest/crc.d from which this page was generated on
github.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Page wiki
View or edit the community-maintained wiki page associated with this page.
Alias std.digest.crc.CRC32Digest
OOP API CRC32
implementation.
See
for differences between template and OOP API.
std.digest.digest
This is an alias for
, see
there for more information.
std.digest.digest.WrapperDigest
!CRC32
Declaration
alias CRC32Digest = WrapperDigest!(std.digest.crc.CRC32)
;
Example
//Simple example, hashing a string using Digest.digest helper function auto crc = new CRC32Digest(); ubyte[] hash = crc.digest("abc"); //Let's get a hash string assert(crcHexString(hash) == "352441C2");
Example
//Let's use the OOP features: void test(Digest dig) { dig.put(cast(ubyte)0); } auto crc = new CRC32Digest(); test(crc); //Let's use a custom buffer: ubyte[4] buf; ubyte[] result = crc.finish(buf[]); assert(crcHexString(result) == "D202EF8D");
Example
//Simple example auto hash = new CRC32Digest(); hash.put(cast(ubyte)0); ubyte[] result = hash.finish();
Example
//using a supplied buffer ubyte[4] buf; auto hash = new CRC32Digest(); hash.put(cast(ubyte)0); ubyte[] 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)
Authors
Pavel "EvilOne" Minayev, Alex Rønne Petersen, Johannes Pfau