peass-ng/PEASS-ng · error · ArgumentException
not supported for SHAKE
Error message
not supported for SHAKE
What it means
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.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/ShakeDigest.cs:24
{
/// <summary>
/// Implementation of SHAKE based on following KeccakNISTInterface.c from http://keccak.noekeon.org/
/// </summary>
/// <remarks>
/// Following the naming conventions used in the C source code to enable easy review of the implementation.
/// </remarks>
public class ShakeDigest
: KeccakDigest, IXof
{
private static int CheckBitLength(int bitLength)
{
switch (bitLength)
{
case 128:
case 256:
return bitLength;
default:
throw new ArgumentException(bitLength + " not supported for SHAKE", "bitLength");
}
}
public ShakeDigest()
: this(128)
{
}
public ShakeDigest(int bitLength)
: base(CheckBitLength(bitLength))
{
}
public ShakeDigest(ShakeDigest source)
: base(source)
{
}
View on GitHub (pinned to 53fb989abc)
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.
Example fix
// before var digest = new ShakeDigest(224); // after var digest = new ShakeDigest(256);
Defensive patterns
Strategy: validation
Validate before calling
bool IsValidShakeBitLength(int bits) => bits == 128 || bits == 256;
Type guard
int? NormalizeShakeBits(int bits) => (bits == 128 || bits == 256) ? bits : (int?)null;
Try / catch
try { var d = new ShakeDigest(bits); }
catch (ArgumentException ex) when (ex.ParamName == "bitLength") { d = new ShakeDigest(256); } Prevention
- 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.
When it happens
Trigger: new ShakeDigest(bitLength) with values like 64, 224, 512, or a parsed size from an algorithm string such as 'SHAKE-224'.
Common situations: Migrating from SHA3Digest sizes to SHAKE; assuming SHAKE supports arbitrary truncation lengths like fixed digests do.
Related errors
- must be in the range [0,7]
- BLAKE2b digest bit length must be a multiple of 8 and not gr
- Invalid digest length (required: 1 - 64)
- BLAKE2s digest bit length must be a multiple of 8 and not gr
- must be in the range 1 to 7
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/271d7c08f0989ac2.
Report an issue: GitHub.