Table of Contents

SecureHashAlgorithm256 Class

Definition

Namespace
Cuemon.Security.Cryptography
Assemblies
Cuemon.Security.Cryptography.dll
Source
src/Cuemon.Security.Cryptography/SecureHashAlgorithm256.cs

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

Name Description
SecureHashAlgorithm256(Action<ConvertibleOptions>)

Initializes a new instance of the SecureHashAlgorithm256 class.

Fields

Name Description
BitSize

Produces a 256-bit hash value

See Also

UnkeyedCryptoHash<TAlgorithm>
Hash<TOptions>