Skein256 Class
Definition
- Namespace
- Bodu.Security.Cryptography
- Assembly
- Bodu.Security.Cryptography.dll
- Package
- Bodu.Security.Cryptography 1.2.0
- Source
- Skein.256.cs
Computes a hash using the Skein-256 variant of the Skein hash function, built on top of the
Threefish256Cipher tweakable block cipher. This class cannot be inherited.
public sealed class Skein256 : Skein, ICryptoTransform, IDisposable
- Inheritance
-
Skein256
- Implements
- Inherited Members
- Extension Methods
Examples
using var skein = new Skein256(); // Skein-256-256
byte[] digest = skein.ComputeHash(message);
using var skeinMac = new Skein256 { Key = key }; // Skein-MAC-256-256
byte[] tag = skeinMac.ComputeHash(message);
Remarks
Skein256 operates on a 256-bit internal state in 32-byte blocks. The permitted output sizes are 128, 160, 224, and 256 bits; 256 bits is the default and matches the Skein 1.3 specification's canonical truncation set for this state size.
Supplying a non-empty Key turns the instance into the keyed Skein-MAC-256 variant by prepending
a KEY UBI phase to the standard CFG → MSG → OUT pipeline. The key length is not fixed: any byte
sequence from zero up to MaxKeySize / 8 bytes is valid.
Parameters at a glance.
- State / block size: 256 bits (32 bytes).
- Output sizes: 128, 160, 224, or 256 bits - default 256.
- Underlying cipher: Threefish256Cipher tweakable block cipher under UBI mode.
- Optional variable-length key: 0-MaxKeySize / 8 bytes.
When to choose Skein-256. The narrowest Skein variant - pick it when 32-byte output is enough and the surrounding system has standardized on Skein. Skein512 is the more common default and offers a stronger security margin; Skein1024 is for cases that want the widest state. For new general-purpose hashing without an interop constraint Blake2b or SHA-2 is the more widely deployed default.
Constructors
Skein256()
Initializes a new instance of the Skein256 class that produces a 256-bit digest.
public Skein256()
Skein256(int)
Initializes a new instance of the Skein256 class with the specified output size.
public Skein256(int hashSize)
Parameters
hashSizeintThe requested output size, in bits. Must be one of
128,160,224, or256.
Exceptions
- ArgumentOutOfRangeException
hashSizeis not one of the permitted output sizes for Skein-256.
Applies to
| Product | Versions |
|---|---|
| .NET | 8, 10 |