Table of Contents

CyclicRedundancyCheckOptions Class

Definition

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

Name Description
CyclicRedundancyCheckOptions()

Initializes a new instance of the CyclicRedundancyCheckOptions class.

Properties

Name Description
ReflectInput

Gets or sets a value indicating whether each byte is reflected before being processed.

ReflectOutput

Gets or sets a value indicating whether the final register value is reflected first.