public static Address FromHash(byte[] bytes) { var hash = CryptoExtensions.SHA256(bytes); hash[0] = SystemOpcode; return(new Address(hash)); }
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)); }
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)); }
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)); }