{"record":{"id":"271d7c08f0989ac2","repo":"peass-ng/PEASS-ng","slug":"not-supported-for-shake","errorCode":null,"errorMessage":" not supported for SHAKE","messagePattern":" not supported for SHAKE","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/ShakeDigest.cs","lineNumber":24,"sourceCode":"{\n    /// <summary>\n    /// Implementation of SHAKE based on following KeccakNISTInterface.c from http://keccak.noekeon.org/\n    /// </summary>\n    /// <remarks>\n    /// Following the naming conventions used in the C source code to enable easy review of the implementation.\n    /// </remarks>\n    public class ShakeDigest\n        : KeccakDigest, IXof\n    {\n        private static int CheckBitLength(int bitLength)\n        {\n            switch (bitLength)\n            {\n            case 128:\n            case 256:\n                return bitLength;\n            default:\n                throw new ArgumentException(bitLength + \" not supported for SHAKE\", \"bitLength\");\n            }\n        }\n\n        public ShakeDigest()\n            : this(128)\n        {\n        }\n\n        public ShakeDigest(int bitLength)\n            : base(CheckBitLength(bitLength))\n        {\n        }\n\n        public ShakeDigest(ShakeDigest source)\n            : base(source)\n        {\n        }\n","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/ShakeDigest.cs#L6-L42","documentation":"ShakeDigest only supports the standardized XOF sizes 128 and 256 bits (SHAKE128/SHAKE256 as defined in FIPS 202). CheckBitLength throws ArgumentException for any other value, appending the unsupported bitLength to the message.","triggerScenarios":"new ShakeDigest(bitLength) with values like 64, 224, 512, or a parsed size from an algorithm string such as 'SHAKE-224'.","commonSituations":"Migrating from SHA3Digest sizes to SHAKE; assuming SHAKE supports arbitrary truncation lengths like fixed digests do.","solutions":["Use new ShakeDigest() (SHAKE128) or new ShakeDigest(256) (SHAKE256).","Restrict config parsing to the values 128 and 256.","For other output sizes, use SHAKE128/256 and call DoFinal with your desired output length."],"exampleFix":"// before\nvar digest = new ShakeDigest(224);\n// after\nvar digest = new ShakeDigest(256);","handlingStrategy":"validation","validationCode":"bool IsValidShakeBitLength(int bits) => bits == 128 || bits == 256;","typeGuard":"int? NormalizeShakeBits(int bits) => (bits == 128 || bits == 256) ? bits : (int?)null;","tryCatchPattern":"try { var d = new ShakeDigest(bits); }\ncatch (ArgumentException ex) when (ex.ParamName == \"bitLength\") { d = new ShakeDigest(256); }","preventionTips":["Whitelist only 128 and 256 for SHAKE.","Remember SHAKE output length is chosen at DoFinal, not construction.","Avoid reusing fixed-digest size tables (224, 384, 512) for SHAKE."],"tags":["csharp","argument-validation","bouncycastle","shake","xof"],"backgroundTag":"invalid-hash-parameter","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}