{"record":{"id":"8533ce05f26e6a20","repo":"peass-ng/PEASS-ng","slug":"digestlength-inappropriate-in-other","errorCode":null,"errorMessage":"digestLength inappropriate in other","messagePattern":"digestLength inappropriate in other","errorType":"exception","errorClass":"MemoableResetException","httpStatus":null,"severity":"error","filePath":"winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/Sha512tDigest.cs","lineNumber":182,"sourceCode":"            while (--num >= 0)\n            {\n                int shift = 8 * (3 - num);\n                bs[off + num] = (byte)(n >> shift);\n            }\n        }\n\n\t\tpublic override IMemoable Copy()\n\t\t{\n\t\t\treturn new Sha512tDigest(this);\n\t\t}\n\n\t\tpublic override void Reset(IMemoable other)\n\t\t{\n\t\t\tSha512tDigest t = (Sha512tDigest)other;\n\n\t\t\tif (this.digestLength != t.digestLength)\n\t\t\t{\n\t\t\t\tthrow new MemoableResetException(\"digestLength inappropriate in other\");\n\t\t\t}\n\n\t\t\tbase.CopyIn(t);\n\n\t\t\tthis.H1t = t.H1t;\n\t\t\tthis.H2t = t.H2t;\n\t\t\tthis.H3t = t.H3t;\n\t\t\tthis.H4t = t.H4t;\n\t\t\tthis.H5t = t.H5t;\n\t\t\tthis.H6t = t.H6t;\n\t\t\tthis.H7t = t.H7t;\n\t\t\tthis.H8t = t.H8t;\n\t\t}\n\n\t}\n}\n","sourceCodeStart":164,"sourceCodeEnd":199,"githubUrl":"https://github.com/peass-ng/PEASS-ng/blob/53fb989abc2219826385683a6fee826bd6cd38d6/winPEAS/winPEASexe/winPEAS/3rdParty/BouncyCastle/crypto/digests/Sha512tDigest.cs#L164-L199","documentation":"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.","triggerScenarios":"Calling digest.Reset(otherDigest) or the copy constructor where other was created as new Sha512tDigest(256) and this as new Sha512tDigest(224).","commonSituations":"Pooling or caching digests of mixed configurations; restoring memoized state after the application changed the configured output size.","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."],"exampleFix":"// before\nif (digest.DigestSize != other.DigestSize) { /* mismatch still reset */ }\ndigest.Reset(other);\n// after\nif (digest.DigestSize == other.DigestSize)\n{\n    digest.Reset(other);\n}\nelse\n{\n    digest = new Sha512tDigest(((Sha512tDigest)other).DigestSize * 8);\n}","handlingStrategy":"type-guard","validationCode":"if (this.digestLength != otherDigest.DigestSize) throw new InvalidOperationException(\"Digest sizes differ; cannot Reset\");","typeGuard":"bool CanResetFrom(Sha512tDigest target, Sha512tDigest other) => target.DigestSize == other.DigestSize;","tryCatchPattern":"try { digest.Reset(other); }\ncatch (MemoableResetException) { digest = new Sha512tDigest(other.DigestSize * 8); digest.Reset(other); }","preventionTips":["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."],"tags":["csharp","bouncycastle","memoable","state-mismatch","hash"],"backgroundTag":"memoable-state-mismatch","analyzedSha":"53fb989abc2219826385683a6fee826bd6cd38d6","analyzedAt":"2026-09-02T04:25:09.259Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T11:17:12.671Z"}