Table of Contents

SecureHashAlgorithm1 Class

Definition

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

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

public sealed class SecureHashAlgorithm1 : UnkeyedCryptoHash<SHA1>, IHash, IConfigurable<ConvertibleOptions>
Inheritance
SecureHashAlgorithm1
Implements
Inherited Members

Examples

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

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

namespace MyApp.Examples;

public static class SecureHashAlgorithm1Example
{
    public static void Demonstrate()
    {
        var algorithm = new SecureHashAlgorithm1();
        var result = algorithm.ComputeHash(Encoding.UTF8.GetBytes("legacy-compatible digest"));

        Console.WriteLine(SecureHashAlgorithm1.BitSize);
        Console.WriteLine(result.GetBytes().Length);
    }
}

Constructors

Name Description
SecureHashAlgorithm1(Action<ConvertibleOptions>)

Initializes a new instance of the SecureHashAlgorithm1 class.

Fields

Name Description
BitSize

Produces a 160-bit hash value

See Also

UnkeyedCryptoHash<TAlgorithm>
Hash<TOptions>