public static HashCode32 ToHashCode32(this IHashValue hashVal, bool strictMode = true) { if (hashVal is null) { return(HashCode32.Zero); } var hex = hashVal.GetHexString(); return(strictMode ? HashCode32.Parse(hex) : HashCode32.ParseLoosely(hex)); }
public static HashCode64 SafeHashCode64(this IHashValue hashVal, bool strictMode = true) { if (hashVal is null) { return(HashCode64.Zero); } var hex = hashVal.GetHexString(); return(strictMode ? HashCode64.TryParse(hex, out var hash) ? hash : HashCode64.Zero : HashCode64.TryParseLoosely(hex, out hash) ? hash : HashCode64.Zero); }