peass-ng/PEASS-ng · error · ArgumentException
Output size must be a multiple of 8 bits. :
Error message
Output size must be a multiple of 8 bits. :
What it means
SkeinEngine is the internal engine for the Skein hash; the constructor takes the output size in bits and requires it to be an integral number of bytes, since outputSizeBytes = outputSizeBits / 8 must be exact. It throws ArgumentException for non-byte-aligned sizes.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/SkeinEngine.cs:526
private readonly UBI ubi;
/**
* Buffer for single byte update method
*/
private readonly byte[] singleByte = new byte[1];
/// <summary>
/// Constructs a Skein digest with an internal state size and output size.
/// </summary>
/// <param name="blockSizeBits">the internal state size in bits - one of <see cref="SKEIN_256"/> <see cref="SKEIN_512"/> or
/// <see cref="SKEIN_1024"/>.</param>
/// <param name="outputSizeBits">the output/digest size to produce in bits, which must be an integral number of
/// bytes.</param>
public SkeinEngine(int blockSizeBits, int outputSizeBits)
{
if (outputSizeBits % 8 != 0)
{
throw new ArgumentException("Output size must be a multiple of 8 bits. :" + outputSizeBits);
}
// TODO: Prevent digest sizes > block size?
this.outputSizeBytes = outputSizeBits / 8;
this.threefish = new ThreefishEngine(blockSizeBits);
this.ubi = new UBI(this,threefish.GetBlockSize());
}
/// <summary>
/// Creates a SkeinEngine as an exact copy of an existing instance.
/// </summary>
public SkeinEngine(SkeinEngine engine)
: this(engine.BlockSize * 8, engine.OutputSize * 8)
{
CopyIn(engine);
}
private void CopyIn(SkeinEngine engine)View on GitHub (pinned to 53fb989abc)
Solutions
- Pass outputSizeBits divisible by 8 (e.g. 256, 512).
- If you have a byte length, multiply by 8.
- Pick a standard configuration like Skein-512-256.
Example fix
// before var engine = new SkeinEngine(512, 255); // after var engine = new SkeinEngine(512, 256);
Defensive patterns
Strategy: validation
Validate before calling
if (outputSizeBits % 8 != 0) throw new ArgumentOutOfRangeException(nameof(outputSizeBits));
Type guard
bool IsByteAlignedBits(int bits) => bits % 8 == 0;
Try / catch
try { var e = new SkeinEngine(blockBits, outBits); }
catch (ArgumentException ex) when (ex.Message.Contains("Output size")) { e = new SkeinEngine(blockBits, (outBits / 8 + 1) * 8); } Prevention
- Prefer SkeinDigest(blockSizeBits, outputSizeBits) with standard pairs (256,128/256; 512,128/256/512).
- Keep lengths in bytes and convert with * 8 at the boundary.
- Validate Skein parameters from config at startup.
When it happens
Trigger: new SkeinEngine(blockSizeBits, outputSizeBits) with outputSizeBits % 8 != 0, e.g. 255, or via SkeinDigest with a bit size not byte-aligned.
Common situations: Passing a digest length in bytes where bits are expected (or vice versa); copy-pasting a custom non-standard Skein parameter set.
Related errors
- BLAKE2b digest bit length must be a multiple of 8 and not gr
- Invalid digest length (required: 1 - 64)
- BLAKE2s digest bit length must be a multiple of 8 and not gr
- must be in the range 1 to 7
- not supported for SHA-3
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/ff55030374d0f831.
Report an issue: GitHub.