コード例 #1
0
        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));
        }
コード例 #2
0
        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);
        }