Table of Contents

Class ChecksumBuilder

Namespace
Cuemon.Data.Integrity
Assembly
Cuemon.Data.Integrity.dll

Provides a way to fluently represent checksum values of arbitrary data.

public class ChecksumBuilder : IDataIntegrity, IEquatable<ChecksumBuilder>
Inheritance
Object
ChecksumBuilder
Implements
IEquatable<ChecksumBuilder>
Derived

Constructors

ChecksumBuilder(Byte[], Func<Hash>)

Initializes a new instance of the ChecksumBuilder class.

public ChecksumBuilder(byte[] checksum, Func<Hash> hashFactory)

Parameters

checksum Byte[]

A byte[] containing a checksum of the data this instance represents.

hashFactory Func<Hash>

The function delegate that is invoked to produce the HashResult.

ChecksumBuilder(Func<Hash>)

Initializes a new instance of the ChecksumBuilder class.

public ChecksumBuilder(Func<Hash> hashFactory)

Parameters

hashFactory Func<Hash>

The function delegate that is invoked to produce the HashResult.

Properties

Bytes

Gets a byte array that is the result of the associated ChecksumBuilder.

protected List<byte> Bytes { get; set; }

Property Value

List<Byte>

The byte array that is the result of the associated ChecksumBuilder.

Checksum

Gets a HashResult containing a computed hash value of the data this instance represents.

public HashResult Checksum { get; }

Property Value

HashResult

A HashResult containing a computed hash value of the data this instance represents.

ComputedHash

Gets or sets the computed checksum of Bytes.

protected HashResult ComputedHash { get; set; }

Property Value

HashResult

The computed checksum of Bytes.

HashFactory

Gets the value factory of this instance.

protected Func<Hash> HashFactory { get; }

Property Value

Func<Hash>

The value factory of this instance.

Methods

CombineWith(Byte[])

Combines the additionalChecksum to the representation of this instance.

public virtual ChecksumBuilder CombineWith(byte[] additionalChecksum)

Parameters

additionalChecksum Byte[]

A byte[] containing a checksum of the additional data this instance must represent.

Returns

ChecksumBuilder

A reference to this instance after the operation has completed.

Equals(ChecksumBuilder)

Indicates whether the current object is equal to another object of the same type.

public virtual bool Equals(ChecksumBuilder other)

Parameters

other ChecksumBuilder

An object to compare with this object.

Returns

Boolean

true if the current object is equal to the other parameter; otherwise, false.

Equals(Object)

Determines whether the specified System.Object is equal to this instance.

public override bool Equals(object obj)

Parameters

obj Object

The System.Object to compare with the current System.Object.

Returns

Boolean

true if the specified System.Object is equal to this instance; otherwise, false.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

Int32

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

ToString()

Converts the the Bytes of this instance to its equivalent hexadecimal representation.

public override string ToString()

Returns

String

A hexadecimal representation of this instance.