Repository navigation
OnixLabs.Security.Cryptography.Sha3Shake256
Represents the FIPS 202 SHAKE256 extendable-output function (XOF).
| Namespace | OnixLabs.Security.Cryptography |
| Assembly | OnixLabs.Security.Cryptography.dll (NuGet) |
| Inheritance |
object → HashAlgorithm → Sha3 → Sha3Shake256
|
public sealed class Sha3Shake256 : Sha3Sha3Shake256 implements the SHAKE256 extendable-output function (XOF) defined in FIPS 202. Like Sha3Shake128, the output size is not predetermined; the caller specifies the desired number of output bytes at construction time via the length parameter.
Key parameters:
- Sponge rate: 136 bytes (same as SHA3-256)
-
Domain-separation delimiter:
0x1f(ShakeDelimiter) -
Output length: caller-supplied, in bytes (
length * 8bits stored internally)
SHAKE256 uses the same rate as SHA3-256 but applies the SHAKE domain-separation byte (0x1f) instead of the hash delimiter (0x06), and the output length is caller-controlled rather than fixed. The narrower rate (compared to SHAKE128's 168 bytes) provides a higher capacity and a security strength capped at 256 bits, making SHAKE256 the preferred XOF when a higher security margin is required.
The preferred instantiation path is the static factory method Sha3.CreateSha3Shake256(int). Constructing directly with new Sha3Shake256(length) is equivalent.
Because Sha3Shake256 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 Sha3Shake256 shake = Sha3.CreateSha3Shake256(length: 32);
byte[] hash = shake.ComputeHash(input);
Console.WriteLine(Convert.ToHexString(hash)); // 64 hex characters (32 bytes)using System.Security.Cryptography;
using OnixLabs.Security.Cryptography;
byte[] input = System.Text.Encoding.UTF8.GetBytes("Hello, World!");
using HashAlgorithm shake = new Sha3Shake256(length: 64);
Hash hash = Hash.Compute(shake, input);
Console.WriteLine(hash.Length); // 64| Constructor | Description |
|---|---|
Sha3Shake256(int) |
Initializes a new instance of the Sha3Shake256 class with the specified output length. |
public Sha3Shake256(int length)Initializes a new instance of the Sha3Shake256 class, configuring the Keccak sponge with a rate of 136 bytes and an output length of length * 8 bits. The sponge state is reset immediately via Initialize.
| Parameter | Type | Description |
|---|---|---|
length |
int |
The desired hash output length in bytes. |
- Sha3 — abstract base class and factory methods
- Sha3Hash224
- Sha3Hash256
- Sha3Hash384
- Sha3Hash512
- Sha3Shake128
- 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