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

Implements a checksum generator that computes the Adler checksum on data More...

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

Public Member Functions

 AdlerChecksum ()
 Initializes a new instance of the Adler checksum generator More...
 
 AdlerChecksum (uint initialValue)
 Initializes a new instance of the Adler 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 adler32 (uint adler, 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 checksum generator that computes the Adler checksum on data

Definition at line 155 of file ChecksumImpl.cs.

Constructor & Destructor Documentation

◆ AdlerChecksum() [1/2]

DotZLib.AdlerChecksum.AdlerChecksum ( )
inline

Initializes a new instance of the Adler checksum generator

Definition at line 167 of file ChecksumImpl.cs.

167 : base() {}

◆ AdlerChecksum() [2/2]

DotZLib.AdlerChecksum.AdlerChecksum ( uint  initialValue)
inline

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

Parameters
initialValueThe value to set the current checksum to

Definition at line 173 of file ChecksumImpl.cs.

173 : base(initialValue) {}

Member Function Documentation

◆ adler32()

static uint DotZLib.AdlerChecksum.adler32 ( uint  adler,
int  data,
uint  length 
)
private

◆ Update()

override void DotZLib.AdlerChecksum.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 184 of file ChecksumImpl.cs.

185  {
186  if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException();
187  if ((offset+count) > data.Length) throw new ArgumentException();
188  GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned);
189  try
190  {
191  _current = adler32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count);
192  }
193  finally
194  {
195  hData.Free();
196  }
197  }
static uint adler32(uint adler, 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, DotZLib.AdlerChecksum.adler32(), and count.


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