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.
Struct std.digest.crc.CRC32
Template API CRC32
implementation.
See
for differences between template and OOP API.
std.digest.digest
Methods
Name | Description |
---|---|
finish
|
Returns the finished CRC32 hash. This also calls start to
reset the internal state.
|
peek
|
Works like but does not reset the internal state, so it's possible
to continue putting data into this CRC32 after a call to peek .
|
put
|
Use this to feed the digest with data .
Also implements the std.range.primitives.isOutputRange
interface for ubyte and const(ubyte)[] .
|
start
|
Used to initialize the CRC32 digest.
|
Example
//Simple example, hashing a string using crc32Of helper function ubyte[4] hash = crc32Of("abc"); //Let's get a hash string assert(crcHexString(hash) == "352441C2");
Example
//Using the basic API CRC32 hash; ubyte[1024] data; //Initialize data here... hash.put(data); ubyte[4] result = hash.finish();
Example
//Let's use the template features: //Note: When passing a CRC32 to a function, it must be passed by reference! void doSomething(T)(ref T hash) if(isDigest!T) { hash.put(cast(ubyte)0); } CRC32 crc; crc.start(); doSomething(crc); assert(crcHexString(crc.finish()) == "D202EF8D");
Authors
Pavel "EvilOne" Minayev, Alex Rønne Petersen, Johannes Pfau