Table of Contents

Class SecureHashAlgorithm256

Namespace
Cuemon.Security.Cryptography
Assembly
Cuemon.Security.Cryptography.dll

Provides a SHA-256 implementation of the SHA (Secure Hash Algorithm) cryptographic hashing algorithm for 256-bit hash values. This class cannot be inherited. Implements the UnkeyedCryptoHash<TAlgorithm>

public sealed class SecureHashAlgorithm256 : UnkeyedCryptoHash<SHA256>, IHash, IConfigurable<ConvertibleOptions>
Inheritance
SecureHashAlgorithm256
Implements
Inherited Members

Examples

The following example demonstrates how to compute a SHA-256 hash with .

using System;
using System.Text;
using Cuemon.Security.Cryptography;

namespace MyApp.Examples;

public static class SecureHashAlgorithm256Example
{
    public static void Demonstrate()
    {
        var algorithm = new SecureHashAlgorithm256();
        var result = algorithm.ComputeHash(Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog"));
        var repeated = algorithm.ComputeHash(Encoding.UTF8.GetBytes("The quick brown fox jumps over the lazy dog"));

        Console.WriteLine(SecureHashAlgorithm256.BitSize);
        Console.WriteLine(result.GetBytes().Length);
        Console.WriteLine(result.Equals(repeated));
    }
}

Constructors

SecureHashAlgorithm256(Action<ConvertibleOptions>)

Initializes a new instance of the SecureHashAlgorithm256 class.

public SecureHashAlgorithm256(Action<ConvertibleOptions> setup = null)

Parameters

setup Action<ConvertibleOptions>

The ConvertibleOptions which may be configured.

Fields

BitSize

Produces a 256-bit hash value

public const int BitSize = 256

Field Value

int

See Also

UnkeyedCryptoHash<TAlgorithm>
Hash<TOptions>