Rizin
unix-like reverse engineering framework and cli tools
DotZLib.ChecksumGeneratorBase Class Referenceabstract

Implements the common functionality needed for all ChecksumGenerators More...

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

Public Member Functions

 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...
 
abstract void Update (byte[] data, int offset, int count)
 Updates the current checksum with part of an array of bytes 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...
 

Protected Attributes

uint _current
 The value of the current checksum More...
 

Properties

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 the common functionality needed for all ChecksumGenerators

Definition at line 20 of file ChecksumImpl.cs.

Constructor & Destructor Documentation

◆ ChecksumGeneratorBase() [1/2]

DotZLib.ChecksumGeneratorBase.ChecksumGeneratorBase ( )
inline

Initializes a new instance of the checksum generator base - the current checksum is set to zero

Definition at line 31 of file ChecksumImpl.cs.

32  {
33  _current = 0;
34  }
uint _current
The value of the current checksum
Definition: ChecksumImpl.cs:25

References DotZLib.ChecksumGeneratorBase._current.

◆ ChecksumGeneratorBase() [2/2]

DotZLib.ChecksumGeneratorBase.ChecksumGeneratorBase ( uint  initialValue)
inline

Initializes a new instance of the checksum generator basewith a specified value

Parameters
initialValueThe value to set the current checksum to

Definition at line 40 of file ChecksumImpl.cs.

41  {
42  _current = initialValue;
43  }

References DotZLib.ChecksumGeneratorBase._current.

Member Function Documentation

◆ Reset()

void DotZLib.ChecksumGeneratorBase.Reset ( )
inline

Resets the current checksum to zero

Implements DotZLib.ChecksumGenerator.

Definition at line 48 of file ChecksumImpl.cs.

48 { _current = 0; }

References DotZLib.ChecksumGeneratorBase._current.

◆ Update() [1/4]

void DotZLib.ChecksumGeneratorBase.Update ( byte[]  data)
inline

Updates the current checksum with an array of bytes.

Parameters
dataThe data to update the checksum with

Implements DotZLib.ChecksumGenerator.

Definition at line 72 of file ChecksumImpl.cs.

73  {
74  Update(data, 0, data.Length);
75  }
abstract void Update(byte[] data, int offset, int count)
Updates the current checksum with part of an array of bytes

References DotZLib.ChecksumGeneratorBase.Update().

◆ Update() [2/4]

abstract void DotZLib.ChecksumGeneratorBase.Update ( byte[]  data,
int  offset,
int  count 
)
pure virtual

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.

All the other Update methods are implmeneted in terms of this one. This is therefore the only method a derived class has to implement

Implements DotZLib.ChecksumGenerator.

Implemented in DotZLib.AdlerChecksum, and DotZLib.CRC32Checksum.

Referenced by DotZLib.ChecksumGeneratorBase.Update().

◆ Update() [3/4]

void DotZLib.ChecksumGeneratorBase.Update ( string  data)
inline

Updates the current checksum with the data from a string

Parameters
dataThe string to update the checksum with

The characters in the string are converted by the UTF-8 encoding

Implements DotZLib.ChecksumGenerator.

Definition at line 82 of file ChecksumImpl.cs.

83  {
84  Update(Encoding.UTF8.GetBytes(data));
85  }

References DotZLib.ChecksumGeneratorBase.Update().

◆ Update() [4/4]

void DotZLib.ChecksumGeneratorBase.Update ( string  data,
Encoding  encoding 
)
inline

Updates the current checksum with the data from a string, using a specific encoding

Parameters
dataThe string to update the checksum with
encodingThe encoding to use

Implements DotZLib.ChecksumGenerator.

Definition at line 92 of file ChecksumImpl.cs.

93  {
94  Update(encoding.GetBytes(data));
95  }

References cmd_descs_generate.encoding, and DotZLib.ChecksumGeneratorBase.Update().

Member Data Documentation

◆ _current

uint DotZLib.ChecksumGeneratorBase._current
protected

Property Documentation

◆ Value

uint DotZLib.ChecksumGeneratorBase.Value
get

Gets the current checksum value

Definition at line 53 of file ChecksumImpl.cs.

53 { get { return _current; } }

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