commit a409b291f28035ae5c366a89da803f06d39c5896
parent d34fea47ca4e5078b16a605bb0242b1845c65a5d
Author: Shivakumar <[email protected]>
Date: Mon, 8 Jun 2026 17:46:32 +0530
feat(crypto): add IsZero method
Signed-off-by: Shivakumar <[email protected]>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/internal/crypto/hash.go b/internal/crypto/hash.go
@@ -80,6 +80,11 @@ func HashCanonical(fields ...[]byte) (Hash, error) {
return HashBytes(canonical), nil
}
+// IsZero checks if the hash is empty.
+func (h Hash) IsZero() bool {
+ return h == Hash{}
+}
+
// String returns the hex representation of the hash.
func (h Hash) String() string {
return hex.EncodeToString(h[:])