Inheritance: IBitcoinSerializable
Exemplo n.º 1
0
 //http://bitcoinj.googlecode.com/git-history/keychain/core/src/main/java/com/google/bitcoin/core/Utils.java
 public static byte[] CreateEncodedMessageD2(string message)
 {
     byte[] messageBytes = Encoding.UTF8.GetBytes(message);
     MemoryStream ms = new MemoryStream();
     ms.WriteByte((byte)BITCOIN_SIGNED_MESSAGE_HEADER_BYTES.Length);
     Write(ms, BITCOIN_SIGNED_MESSAGE_HEADER_BYTES);
     VarInt size = new VarInt((ulong)messageBytes.Length);
     Write(ms, size.ToBytes());
     Write(ms, messageBytes);
     byte[] data = ms.ToArray();
     using (var sha = new SHA256Managed())
     {
         var h = sha.ComputeHash(data, 0, data.Length);
         return sha.ComputeHash(h, 0, h.Length);
     }
 }