Repository navigation
OnixLabs.Security.Cryptography.Sha3Hash256
Represents the FIPS 202 SHA-3 256-bit fixed-length hash algorithm.
| Namespace | OnixLabs.Security.Cryptography |
| Assembly | OnixLabs.Security.Cryptography.dll (NuGet) |
| Inheritance |
object → HashAlgorithm → Sha3 → Sha3Hash256
|
public sealed class Sha3Hash256 : Sha3Sha3Hash256 implements the SHA3-256 variant of the FIPS 202 standard. It always produces a 256-bit (32-byte) digest. The sponge rate is fixed at 136 bytes and the domain-separation delimiter 0x06 (HashDelimiter) is applied during padding, as required by FIPS 202 for the fixed-length hash family.
Because the output length is baked into the constructor, the digest size cannot be changed after construction. Use Sha3Shake128 or Sha3Shake256 if a variable-length output is needed.
Note SHA3-256 and SHAKE256 share the same sponge rate (136 bytes) but differ in their domain-separation delimiter (
0x06vs0x1f) and in whether the output length is fixed or caller-controlled.
The preferred instantiation path is the static factory method Sha3.CreateSha3Hash256(). Constructing directly with new Sha3Hash256() is equivalent.
Because Sha3Hash256 extends HashAlgorithm, it integrates with all BCL hashing idioms: ComputeHash, TransformBlock / TransformFinalBlock, the using-disposable pattern, and Hash.Compute all work without modification.
using OnixLabs.Security.Cryptography;
byte[] input = System.Text.Encoding.UTF8.GetBytes("Hello, World!");
using Sha3Hash256 sha3 = Sha3.CreateSha3Hash256();
byte[] hash = sha3.ComputeHash(input);
Console.WriteLine(Convert.ToHexString(hash));
// 1AF17A664E3FA8E419B8BA05C2A173169DF76162A5A286E0C405B460D478F7EFusing System.Security.Cryptography;
using OnixLabs.Security.Cryptography;
byte[] input = System.Text.Encoding.UTF8.GetBytes("Hello, World!");
using HashAlgorithm sha3 = new Sha3Hash256();
Hash hash = Hash.Compute(sha3, input);
Console.WriteLine(hash); // lowercase hex, 64 characters| Constructor | Description |
|---|---|
Sha3Hash256() |
Initializes a new instance of the Sha3Hash256 class. |
public Sha3Hash256()Initializes a new instance of the Sha3Hash256 class, configuring the Keccak sponge with a rate of 136 bytes and a 256-bit output length. The sponge state is reset immediately via Initialize.
- Sha3 — abstract base class and factory methods
- Sha3Hash224
- Sha3Hash384
- Sha3Hash512
- Sha3Shake128
- Sha3Shake256
- Hash
- OnixLabs.Security.Cryptography
- Home
- OnixLabs.Security.Cryptography on NuGet
ONIXLabs .NET Library · Repository · NuGet · License (Apache-2.0)
Copyright © ONIXLabs 2020. Licensed under the Apache License, Version 2.0.
- Enumeration<T>
- Optional<T>
- OptionalEqualityComparer<T>
- OptionalExtensions
- Result
- Result<T>
- ResultEqualityComparer<T>
- ResultExtensions
- Specification<T>
- Preconditions
- IValueEquatable<T>
- IValueComparable<T>
- IBinaryConvertible
- ISpanBinaryConvertible
- IMemoryBinaryConvertible
- ArrayExtensions
- ComparableExtensions
- DateTimeExtensions
- ISpanParsableExtensions
- ObjectExtensions
- RandomExtensions
- ReadOnlySequenceExtensions
- ReadOnlySpanExtensions
- StringExtensions
- Base16
- Base32
- Base58
- Base64
- IBaseCodec
- IBaseValue
- IBaseValue<T>
- Base16Codec
- Base32Codec
- Base58Codec
- Base64Codec
- Base16FormatProvider
- Base32FormatProvider
- Base58FormatProvider
- Base64FormatProvider
- EncodingExtensions
- ReadOnlySpanExtensions
- StringBuilderExtensions
- BigDecimal
- BigDecimalEqualityComparer
- BigDecimalOrdinalityComparer
- NumberInfo
- NumberInfoEqualityComparer
- NumberInfoOrdinalityComparer
- Int256
- Int512
- UInt256
- UInt512
- Float128
- Float256
- GenericMath
- NumericsExtensions
- ConversionMode
- ScaleMode
- Hash
- NamedHash
- Sha3
- Sha3Hash224
- Sha3Hash256
- Sha3Hash384
- Sha3Hash512
- Sha3Shake128
- Sha3Shake256
- MerkleTree
- MerkleTree<T>
- PrivateKey
- PublicKey
- NamedPrivateKey
- NamedPublicKey
- EcdhPrivateKey
- EcdhPublicKey
- EcdsaPrivateKey
- EcdsaPublicKey
- EddsaPrivateKey
- EddsaPublicKey
- RsaPrivateKey
- RsaPublicKey
- DigitalSignature
- DigitalSignatureAndPublicKey
- Salt
- Secret
- ICryptoPrimitive<T>
- IHashable
- IEcdhPrivateKey
- IEcdsaPrivateKey
- IEddsaPrivateKey
- IRsaPrivateKey
- IPrivateKeyDerivable<T>
- IPrivateKeyExportable
- IPrivateKeyImportable<T>
- IPrivateKeyPemImportable<T>
- IPrivateKeyPkcs8Exportable
- IPrivateKeyPkcs8Importable<T>
- IPrivateKeyPkcs8PemExportable
- IPrivateKeyRawExportable
- IPrivateKeyRawImportable<T>
- IPrivateKeyRawPemExportable
- IEcdhPublicKey
- IEcdsaPublicKey
- IEddsaPublicKey
- IRsaPublicKey
- IPublicKeyExportable
- IPublicKeyImportable<T>
- IPublicKeyPemExportable
- IPublicKeyPemImportable<T>
- IPublicKeyRawExportable
- IPublicKeyRawImportable<T>
- HashAlgorithmExtensions
- ReadOnlySpanExtensions