Rizin
unix-like reverse engineering framework and cli tools
DotZLib.CRC32Checksum Class Reference

Implements a CRC32 checksum generator More...

Inheritance diagram for DotZLib.CRC32Checksum:
DotZLib.ChecksumGeneratorBase DotZLib.ChecksumGenerator

Public Member Functions

 CRC32Checksum ()
 Initializes a new instance of the CRC32 checksum generator More...
 
 CRC32Checksum (uint initialValue)
 Initializes a new instance of the CRC32 checksum generator with a specified value More...
 
override void Update (byte[] data, int offset, int count)
 Updates the current checksum with part of an array of bytes More...
 
- Public Member Functions inherited from DotZLib.ChecksumGeneratorBase
 ChecksumGeneratorBase ()
 Initializes a new instance of the checksum generator base - the current checksum is set to zero More...
 
 ChecksumGeneratorBase (uint initialValue)
 Initializes a new instance of the checksum generator basewith a specified value More...
 
void Reset ()
 Resets the current checksum to zero More...
 
void Update (byte[] data)
 Updates the current checksum with an array of bytes. More...
 
void Update (string data)
 Updates the current checksum with the data from a string More...
 
void Update (string data, Encoding encoding)
 Updates the current checksum with the data from a string, using a specific encoding More...
 

Private Member Functions

static uint crc32 (uint crc, int data, uint length)
 

Additional Inherited Members

- Protected Attributes inherited from DotZLib.ChecksumGeneratorBase
uint _current
 The value of the current checksum More...
 
- Properties inherited from DotZLib.ChecksumGeneratorBase
uint Value [get]
 Gets the current checksum value More...
 
- Properties inherited from DotZLib.ChecksumGenerator
uint Value [get]
 Gets the current value of the checksum More...
 

Detailed Description

Implements a CRC32 checksum generator

Definition at line 104 of file ChecksumImpl.cs.

Constructor & Destructor Documentation

◆ CRC32Checksum() [1/2]

DotZLib.CRC32Checksum.CRC32Checksum ( )
inline

Initializes a new instance of the CRC32 checksum generator

Definition at line 116 of file ChecksumImpl.cs.

116 : base() {}

◆ CRC32Checksum() [2/2]

DotZLib.CRC32Checksum.CRC32Checksum ( uint  initialValue)
inline

Initializes a new instance of the CRC32 checksum generator with a specified value

Parameters
initialValueThe value to set the current checksum to

Definition at line 122 of file ChecksumImpl.cs.

122 : base(initialValue) {}

Member Function Documentation

◆ crc32()

static uint DotZLib.CRC32Checksum.crc32 ( uint  crc,
int  data,
uint  length 
)
private

◆ Update()

override void DotZLib.CRC32Checksum.Update ( byte[]  data,
int  offset,
int  count 
)
inlinevirtual

Updates the current checksum with part of an array of bytes

Parameters
dataThe data to update the checksum with
offsetWhere in data to start updating
countThe number of bytes from data to use
Exceptions
ArgumentExceptionThe sum of offset and count is larger than the length of data
NullReferenceExceptiondata is a null reference
ArgumentOutOfRangeExceptionOffset or count is negative.

Implements DotZLib.ChecksumGeneratorBase.

Definition at line 133 of file ChecksumImpl.cs.

134  {
135  if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
136  if ((offset+count) > data.Length) throw new ArgumentException();
137  GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
138  try
139  {
140  _current = crc32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
141  }
142  finally
143  {
144  hData.Free();
145  }
146  }
static uint crc32(uint crc, int data, uint length)
uint _current
The value of the current checksum
Definition: ChecksumImpl.cs:25
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
Definition: sflib.h:98
unsigned int uint
Definition: gzlog.c:242
voidpf uLong offset
Definition: ioapi.h:144

References DotZLib.ChecksumGeneratorBase._current, count, and DotZLib.CRC32Checksum.crc32().


The documentation for this class was generated from the following file: