public void Parsing()
 {
     Assert.False(HashCode256.TryParse(null, out HashCode256 hash));
     Assert.False(HashCode256.TryParse("", out hash));
     Assert.False(HashCode256.TryParse("123456789ABCDE", out hash));
     Assert.False(HashCode256.TryParse("Well, this isn't likely to work, is it?", out hash));
     Assert.False(HashCode256.TryParse("123456789abcdef01", out hash));
     Assert.Equal(hash, HashCode256.Zero);
     Assert.Equal(default(HashCode256), hash);
     Assert.True(HashCode256.TryParse("123456789abcdef00fedcba987654321123456789abcdef00fedcba987654321", out hash));
     Assert.Equal(hash, HashCode256.Parse("  123456789ABCD EF0  0fe DCB a98 765 4321   123456789AbcdeF0 0FED cbA 987 65 4321"));
     Assert.Equal(HashCode256.Parse("0000000000000000000000000000000000000000000000000000000000000000"), HashCode256.Zero);
     Assert.Equal(hash.GetHashCode(), HashCode256.Parse("123456789abcdef00fedcba987654321123456789abcdef00fedcba987654321").GetHashCode());
     Assert.NotEqual(hash.GetHashCode(), HashCode256.Zero.GetHashCode());
     Assert.Equal(0, HashCode256.Zero.GetHashCode());
     Assert.Equal <ulong>(0x123456789abcdef0, hash.UHash1);
     Assert.Equal <ulong>(0x0fedcba987654321, hash.UHash2);
     Assert.Equal <ulong>(0x123456789abcdef0, hash.UHash3);
     Assert.Equal <ulong>(0x0fedcba987654321, hash.UHash4);
     Assert.Equal(0x123456789abcdef0, hash.Hash1);
     Assert.Equal(0x0fedcba987654321, hash.Hash2);
     Assert.Equal(0x123456789abcdef0, hash.Hash3);
     Assert.Equal(0x0fedcba987654321, hash.Hash4);
     Assert.Equal(hash, new HashCode256(0x123456789abcdef0u, 0x0fedcba987654321, 0x123456789abcdef0u, 0x0fedcba987654321));
     Assert.Equal(hash, new HashCode256(0x123456789abcdef0, 0x0fedcba987654321, 0x123456789abcdef0, 0x0fedcba987654321));
     Assert.Equal(hash, HashCode256.Parse("0x123456789abcdef00fedcba987654321123456789abcdef00fedcba987654321"));
     Assert.Equal(hash, HashCode256.Parse("0x123456789abcdef00fedcba987654321123456789abcdef00fedcba987654321"));
     Assert.False(HashCode256.TryParse("x123456789abcdef00fedcba987654321123456789abcdef00fedcba987654321", out hash));
     Assert.False(HashCode256.TryParse("0xx123456789abcdef00fedcba987654321123456789abcdef00fedcba987654321", out hash));
     Assert.False(HashCode256.TryParse("1234x6789abcdef00fedcba987654321123456789abcdef00fedcba987654321", out hash));
 }
        public static HashCode256 SafeHashCode256(this IHashValue hashVal, bool strictMode = true)
        {
            if (hashVal is null)
            {
                return(HashCode256.Zero);
            }

            var hex = hashVal.GetHexString();

            return(strictMode
                ? HashCode256.TryParse(hex, out var hash)
                    ? hash
                    : HashCode256.Zero
                : HashCode256.TryParseLoosely(hex, out hash)
                    ? hash
                    : HashCode256.Zero);
        }