{"record":{"id":"dcf628ba66af06fe","repo":"peass-ng/PEASS-ng","slug":"incompatible-parameters-in-provided-skeinengine","errorCode":null,"errorMessage":"Incompatible parameters in provided SkeinEngine.","messagePattern":"Incompatible parameters in provided SkeinEngine\\.","errorType":"exception","errorClass":"MemoableResetException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/SkeinEngine.cs","lineNumber":578,"sourceCode":"            if ((existing == null) || (existing.Length != data.Length))\n            {\n                existing = new Parameter[data.Length];\n            }\n            Array.Copy(data, 0, existing, 0, existing.Length);\n            return existing;\n        }\n\n        public IMemoable Copy()\n        {\n            return new SkeinEngine(this);\n        }\n\n        public void Reset(IMemoable other)\n        {\n            SkeinEngine s = (SkeinEngine)other;\n            if ((BlockSize != s.BlockSize) || (outputSizeBytes != s.outputSizeBytes))\n            {\n                throw new MemoableResetException(\"Incompatible parameters in provided SkeinEngine.\");\n            }\n            CopyIn(s);\n        }\n\n        public int OutputSize\n        {\n            get { return outputSizeBytes; }\n        }\n\n        public int BlockSize\n        {\n            get { return threefish.GetBlockSize (); }\n        }\n\n        /// <summary>\n        /// Initialises the Skein engine with the provided parameters. See <see cref=\"Org.BouncyCastle.Crypto.Parameters.SkeinParameters\"/> for\n        /// details on the parameterisation of the Skein hash function.\n        /// </summary>","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/SkeinEngine.cs#L560-L596","documentation":"SkeinEngine.Reset(IMemoable) restores state from another SkeinEngine. Because Skein's internal state depends on block size and output size, the library throws MemoableResetException('Incompatible parameters in provided SkeinEngine.') when either differs between the two engines.","triggerScenarios":"Calling Reset(otherEngine) where other was created as new SkeinEngine(512, 256) but this as new SkeinEngine(1024, 256), or output sizes differ.","commonSituations":"Digest pooling/caching with mixed Skein parameter sets; reusing a cached engine after the application changed Skein configuration.","solutions":["Only reset from engines created with the same blockSizeBits and outputSizeBits.","Create a new SkeinEngine/SkeinDigest with the other's parameters instead of resetting.","Key cached engines by (blockSize, outputSize) so lookups never cross configurations."],"exampleFix":"// before\nengine.Reset(otherEngine); // may have different params\n// after\nif (engine.BlockSize == otherEngine.BlockSize)\n{\n    engine.Reset(otherEngine);\n}\nelse\n{\n    engine = new SkeinEngine(otherEngine.BlockSize, otherEngine.OutputSize * 8);\n}","handlingStrategy":"type-guard","validationCode":"if (engine.BlockSize != otherEngine.BlockSize || engine.OutputSize != otherEngine.OutputSize) throw new InvalidOperationException(\"Incompatible Skein parameters\");","typeGuard":"bool CanResetFrom(SkeinEngine target, SkeinEngine other) => target.BlockSize == other.BlockSize && target.OutputSize == other.OutputSize;","tryCatchPattern":"try { engine.Reset(other); }\ncatch (MemoableResetException) { engine = new SkeinEngine(other.BlockSize, other.OutputSize * 8); engine.Reset(other); }","preventionTips":["Pool Skein engines keyed by (blockSize, outputSize).","Never share memoized state across different Skein configurations.","Construct engines from a single source of truth for parameters."],"tags":["csharp","bouncycastle","memoable","skein","state-mismatch"],"backgroundTag":"memoable-state-mismatch","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}