Table of Contents

SHA512256 Class

Definition

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

Represents the SHA-512/256 cryptographic hash algorithm, which produces a 256-bit hash value using the SHA-512 algorithm as its base.

public sealed class SHA512256 : HashAlgorithm, ICryptoTransform, IDisposable
Inheritance
SHA512256
Implements
Inherited Members

Examples

The following example demonstrates how to use the low-level implementation directly through .

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

namespace MyApp.Examples;

public static class SHA512256Example
{
    public static void Demonstrate()
    {
        using var algorithm = new SHA512256();

        var digest = algorithm.ComputeHash(Encoding.UTF8.GetBytes("Hello, world!"));
        algorithm.Initialize();
        var secondDigest = algorithm.ComputeHash(Encoding.UTF8.GetBytes("Hello, world!"));

        Console.WriteLine(digest.Length);
        Console.WriteLine(digest.Length == secondDigest.Length);
    }
}

Remarks

Full disclosure; this class was created in collaboration with OpenAI ChatGPT. Have a look at the prompt here: https://chatgpt.com/share/67fbd1fe-17d8-8010-8144-e94251c2e79d

Constructors

Name Description
SHA512256()

Initializes a new instance of the SHA512256 class.

Methods

Name Description
HashCore(byte[], int, int)

Routes data written to the object into the hash algorithm for computing the hash.

HashFinal()

Finalizes the hash computation after the last data is processed.

Initialize()

Initializes the hash algorithm, resetting its state.