peass-ng/PEASS-ng · error · MemoableResetException
digestLength inappropriate in other
Error message
digestLength inappropriate in other
What it means
Reset(IMemoable) restores state from another Sha512tDigest instance. The library throws MemoableResetException when the other digest was constructed with a different bitLength (digestLength), because its internal state is incompatible with this instance.
Source
Thrown at winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/Sha512tDigest.cs:182
while (--num >= 0)
{
int shift = 8 * (3 - num);
bs[off + num] = (byte)(n >> shift);
}
}
public override IMemoable Copy()
{
return new Sha512tDigest(this);
}
public override void Reset(IMemoable other)
{
Sha512tDigest t = (Sha512tDigest)other;
if (this.digestLength != t.digestLength)
{
throw new MemoableResetException("digestLength inappropriate in other");
}
base.CopyIn(t);
this.H1t = t.H1t;
this.H2t = t.H2t;
this.H3t = t.H3t;
this.H4t = t.H4t;
this.H5t = t.H5t;
this.H6t = t.H6t;
this.H7t = t.H7t;
this.H8t = t.H8t;
}
}
}
View on GitHub (pinned to 53fb989abc)
Solutions
- Ensure both digests were constructed with the same bitLength before Reset.
- Create a fresh Sha512tDigest with the other's bitLength instead of resetting.
- Centralize digest construction so all instances share one configured size.
Example fix
// before
if (digest.DigestSize != other.DigestSize) { /* mismatch still reset */ }
digest.Reset(other);
// after
if (digest.DigestSize == other.DigestSize)
{
digest.Reset(other);
}
else
{
digest = new Sha512tDigest(((Sha512tDigest)other).DigestSize * 8);
} Defensive patterns
Strategy: type-guard
Validate before calling
if (this.digestLength != otherDigest.DigestSize) throw new InvalidOperationException("Digest sizes differ; cannot Reset"); Type guard
bool CanResetFrom(Sha512tDigest target, Sha512tDigest other) => target.DigestSize == other.DigestSize;
Try / catch
try { digest.Reset(other); }
catch (MemoableResetException) { digest = new Sha512tDigest(other.DigestSize * 8); digest.Reset(other); } Prevention
- Key digest pools by digest size.
- Only call Reset with instances from the same construction site/config.
- Prefer the copy constructor Sha512tDigest(t) only when sizes are known equal.
When it happens
Trigger: Calling digest.Reset(otherDigest) or the copy constructor where other was created as new Sha512tDigest(256) and this as new Sha512tDigest(224).
Common situations: Pooling or caching digests of mixed configurations; restoring memoized state after the application changed the configured output size.
Related errors
- Incompatible parameters in provided SkeinEngine.
- cannot be >= 512
- needs to be a multiple of 8
- cannot be 384 use SHA384 instead
- baseDigest
AI-assisted analysis of peass-ng/PEASS-ng@53fb989abc (2026-09-02).
Data as JSON: /api/errors/8533ce05f26e6a20.
Report an issue: GitHub.