What changed, and why it matters
This is a tiny C++ code cleanup. The function `cn_variant1_check` was marked `constexpr` (a hint that it can be evaluated at compile time), but because it contains a runtime-only check (`if (variant == 1 && length < 43)` followed by an error path), that marking is invalid in newer C++ standards. The patch simply removes the `constexpr` keyword so the code compiles correctly. There is no change to what the function actually does, no security behavior change, and no bug fix beyond compiler compliance.
No security action required. Treat as a normal build/compilation hygiene patch.
Security signals we found
No security-relevant logic change
No input validation change
No memory safety, cryptographic, or consensus change
Compiler compliance / build fix only
Evidence from the diff
The commit removes the constexpr specifier from static constexpr void cn_variant1_check(...). A constexpr function in C++14/C++17 must be callable in a constant expression, which generally requires all paths to be valid constant expressions. The function body performs a runtime validation (if (variant == 1 && length < 43)) and presumably aborts/throws on failure, making it unsuitable for constexpr evaluation. The patch is purely a standards-compliance/compiler-warning fix; the function logic, parameters, and runtime behavior are unchanged.
Changed components
src/crypto/hash.hcrypto::cn_variant1_checkInspect captured patch +1 / −1
diff --git a/src/crypto/hash.h b/src/crypto/hash.h
index f96e759..a0dd92b 100644
--- a/src/crypto/hash.h
+++ b/src/crypto/hash.h
@@ -71,7 +71,7 @@ namespace crypto {
return h;
}
- static constexpr void cn_variant1_check(const std::size_t length, const int variant)
+ static void cn_variant1_check(const std::size_t length, const int variant)
{
// see VARIANT1_CHECK in slow-hash.c
if (variant == 1 && length < 43)
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.