{"record":{"id":"ff55030374d0f831","repo":"peass-ng/PEASS-ng","slug":"output-size-must-be-a-multiple-of-8-bits","errorCode":null,"errorMessage":"Output size must be a multiple of 8 bits. :","messagePattern":"Output size must be a multiple of 8 bits\\. :","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/SkeinEngine.cs","lineNumber":526,"sourceCode":"        private readonly UBI ubi;\n\n        /**\n         * Buffer for single byte update method\n         */\n        private readonly byte[] singleByte = new byte[1];\n\n        /// <summary>\n        /// Constructs a Skein digest with an internal state size and output size.\n        /// </summary>\n        /// <param name=\"blockSizeBits\">the internal state size in bits - one of <see cref=\"SKEIN_256\"/> <see cref=\"SKEIN_512\"/> or\n        ///                       <see cref=\"SKEIN_1024\"/>.</param>\n        /// <param name=\"outputSizeBits\">the output/digest size to produce in bits, which must be an integral number of\n        ///                      bytes.</param>\n        public SkeinEngine(int blockSizeBits, int outputSizeBits)\n        {\n            if (outputSizeBits % 8 != 0)\n            {\n                throw new ArgumentException(\"Output size must be a multiple of 8 bits. :\" + outputSizeBits);\n            }\n            // TODO: Prevent digest sizes > block size?\n            this.outputSizeBytes = outputSizeBits / 8;\n\n            this.threefish = new ThreefishEngine(blockSizeBits);\n            this.ubi = new UBI(this,threefish.GetBlockSize());\n        }\n\n        /// <summary>\n        /// Creates a SkeinEngine as an exact copy of an existing instance.\n        /// </summary>\n        public SkeinEngine(SkeinEngine engine)\n            : this(engine.BlockSize * 8, engine.OutputSize * 8)\n        {\n            CopyIn(engine);\n        }\n\n        private void CopyIn(SkeinEngine engine)","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/SkeinEngine.cs#L508-L544","documentation":"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.","triggerScenarios":"new SkeinEngine(blockSizeBits, outputSizeBits) with outputSizeBits % 8 != 0, e.g. 255, or via SkeinDigest with a bit size not byte-aligned.","commonSituations":"Passing a digest length in bytes where bits are expected (or vice versa); copy-pasting a custom non-standard Skein parameter set.","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."],"exampleFix":"// before\nvar engine = new SkeinEngine(512, 255);\n// after\nvar engine = new SkeinEngine(512, 256);","handlingStrategy":"validation","validationCode":"if (outputSizeBits % 8 != 0) throw new ArgumentOutOfRangeException(nameof(outputSizeBits));","typeGuard":"bool IsByteAlignedBits(int bits) => bits % 8 == 0;","tryCatchPattern":"try { var e = new SkeinEngine(blockBits, outBits); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"Output size\")) { e = new SkeinEngine(blockBits, (outBits / 8 + 1) * 8); }","preventionTips":["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."],"tags":["csharp","argument-validation","bouncycastle","skein"],"backgroundTag":"invalid-hash-parameter","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}