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

  1. Pass outputSizeBits divisible by 8 (e.g. 256, 512).
  2. If you have a byte length, multiply by 8.
  3. 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

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


AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02). Data as JSON: /api/errors/ff55030374d0f831. Report an issue: GitHub.