예제 #1
0
        public static byte[] Hash160(byte[] message)
        {
            var hashBuffer = new byte[HashHelpers.Hash160Size];

            if (HashHelpers.TryHash160(message, hashBuffer))
            {
                return(hashBuffer);
            }

            throw new ArgumentException(nameof(message));
        }
예제 #2
0
        public static UInt160 HashScript(byte[] script)
        {
            Span <byte> buffer = stackalloc byte[HashHelpers.Hash160Size];

            if (HashHelpers.TryHash160(script, buffer))
            {
                return(new UInt160(buffer));
            }

            throw new ArgumentException(nameof(script));
        }
예제 #3
0
        private static UInt160 CalculateScriptHash(ImmutableArray <byte> script)
        {
            Span <byte> buffer = stackalloc byte[UInt160.Size];

            if (HashHelpers.TryHash160(script.AsSpan(), buffer))
            {
                return(new UInt160(buffer));
            }

            throw new Exception();
        }