Exemple #1
0
        public static Address FromHash(byte[] bytes)
        {
            var hash = CryptoExtensions.SHA256(bytes);

            hash[0] = SystemOpcode;
            return(new Address(hash));
        }
Exemple #2
0
        public static Address FromHash(byte[] input)
        {
            var hash  = CryptoExtensions.SHA256(input);
            var bytes = ByteArrayUtils.ConcatBytes(new byte[] { (byte)AddressKind.System, 0 }, hash);

            return(new Address(bytes));
        }
Exemple #3
0
        public static Hash FromBytes(byte[] input)
        {
            if (input.Length > Length)
            {
                input = CryptoExtensions.SHA256(input);
            }

            var bytes = new byte[Length];

            Array.Copy(input, bytes, input.Length);
            return(new Hash(bytes));
        }
Exemple #4
0
        public static Hash FromBytes(byte[] input)
        {
            if (input.Length != Length) // NOTE this is actually problematic, better to separate into 2 methods
            {
                input = CryptoExtensions.SHA256(input);
            }

            var bytes = new byte[Length];

            Array.Copy(input, bytes, input.Length);
            return(new Hash(bytes));
        }