Class CyclicRedundancyCheckOptions
Configuration options for CyclicRedundancyCheck.
public class CyclicRedundancyCheckOptions : ConvertibleOptions, IParameterObject
- Inheritance
-
CyclicRedundancyCheckOptions
- Implements
- Inherited Members
Examples
The following example shows how to reuse one CyclicRedundancyCheckOptions instance when configuring a checksum implementation.
using System;
using System.Text;
using Cuemon;
using Cuemon.Security;
namespace MyApp.Examples;
public static class CyclicRedundancyCheckOptionsExample
{
public static void Demonstrate()
{
var options = new CyclicRedundancyCheckOptions
{
ByteOrder = Endianness.LittleEndian,
ReflectInput = true,
ReflectOutput = true
};
var checksum = new CyclicRedundancyCheck32(setup: configured =>
{
configured.ByteOrder = options.ByteOrder;
configured.ReflectInput = options.ReflectInput;
configured.ReflectOutput = options.ReflectOutput;
});
Console.WriteLine(options.ByteOrder);
Console.WriteLine(options.ReflectInput);
Console.WriteLine(options.ReflectOutput);
Console.WriteLine(checksum.ComputeHash(Encoding.ASCII.GetBytes("123456789")).ToHexadecimalString());
}
}
Constructors
CyclicRedundancyCheckOptions()
Initializes a new instance of the CyclicRedundancyCheckOptions class.
public CyclicRedundancyCheckOptions()
Remarks
The following table shows the initial property values for an instance of CyclicRedundancyCheckOptions.
| Property | Initial Value |
|---|---|
| ByteOrder | BigEndian |
| ReflectOutput | false |
| ReflectInput | false |
Properties
ReflectInput
Gets or sets a value indicating whether each byte is reflected before being processed.
public bool ReflectInput { get; set; }
Property Value
- bool
trueif each byte is reflected before being processed; otherwise,false.
Remarks
More information can be found @ http://www.ross.net/crc/download/crc_v3.txt
ReflectOutput
Gets or sets a value indicating whether the final register value is reflected first.
public bool ReflectOutput { get; set; }
Property Value
- bool
trueif the final register value is reflected first; otherwise,false.
Remarks
More information can be found @ http://www.ross.net/crc/download/crc_v3.txt