{"record":{"id":"2c52133bfd7256be","repo":"peass-ng/PEASS-ng","slug":"skein-key-must-be-at-least-128-bits","errorCode":null,"errorMessage":"Skein key must be at least 128 bits.","messagePattern":"Skein key must be at least 128 bits\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/SkeinEngine.cs","lineNumber":610,"sourceCode":"\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>\n        /// <param name=\"parameters\">the parameters to apply to this engine, or <code>null</code> to use no parameters.</param>\n        public void Init(SkeinParameters parameters)\n        {\n            this.chain = null;\n            this.key = null;\n            this.preMessageParameters = null;\n            this.postMessageParameters = null;\n\n            if (parameters != null)\n            {\n                byte[] key = parameters.GetKey();\n                if (key.Length < 16)\n                {\n                    throw new ArgumentException(\"Skein key must be at least 128 bits.\");\n                }\n                InitParams(parameters.GetParameters());\n            }\n            CreateInitialState();\n\n            // Initialise message block\n            UbiInit(PARAM_TYPE_MESSAGE);\n        }\n\n        private void InitParams(IDictionary parameters)\n        {\n            IEnumerator keys = parameters.Keys.GetEnumerator();\n            IList pre = Platform.CreateArrayList();\n            IList post = Platform.CreateArrayList();\n\n            while (keys.MoveNext())\n            {\n                int type = (int)keys.Current;","sourceCodeStart":592,"sourceCodeEnd":628,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/SkeinEngine.cs#L592-L628","documentation":"SkeinEngine requires a key of at least 16 bytes (128 bits) when initialized with a SkeinParameters object. The library enforces this minimum because Skein's UBI chaining needs a non-trivial key for the key-absorb block; shorter keys would produce a degenerate hash. Thrown as ArgumentException during Init.","triggerScenarios":"Calling Init(SkeinParameters) whose key byte[] has length < 16, e.g. built via SkeinParameters.Builder().SetKey(shortKey).Build().","commonSituations":"Passing a 64-bit or 96-bit key from a config file, truncating a key to fewer than 16 bytes, or using a legacy stored key that predates the 128-bit minimum.","solutions":["Provide a key byte[] of at least 16 bytes in SkeinParameters","If a smaller key must be accepted, pad/hash it to >= 16 bytes before building parameters","Use SetKey with the full 32/64-byte key recommended by your Skein parameter choice"],"exampleFix":"// before\nvar p = new SkeinParameters.Builder().SetKey(shortKeyBytes).Build();\nengine.Init(p);\n// after\nif (shortKeyBytes.Length < 16) shortKeyBytes = new byte[16]; // or stretch via KDF\nvar p = new SkeinParameters.Builder().SetKey(shortKeyBytes).Build();\nengine.Init(p);","handlingStrategy":"validation","validationCode":"if (keyBytes == null || keyBytes.Length < 16) throw new ArgumentException(\"Skein key must be >= 16 bytes\");","typeGuard":"static bool IsValidSkeinKey(byte[] key) => key != null && key.Length >= 16;","tryCatchPattern":"try { engine.Init(skeinParams); } catch (ArgumentException ex) { /* handle key-size error: ex.Message.Contains(\"at least 128 bits\") */ }","preventionTips":["Always generate keys with a CSPRNG at 128 bits minimum","Validate key length immediately after loading/decoding key material","Prefer 256/512-bit keys for Skein as recommended by the spec"],"tags":["csharp","cryptography","argument-validation"],"backgroundTag":"cipher-key-too-short","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}