Files
btcpayserver/BTCPayServer/AtomicSwaps/Preimage.cs
nicolas.dorier b0cb92696a atomic swap
2018-10-10 01:05:24 +09:00

32 lines
588 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using NBitcoin;
using NBitcoin.Crypto;
namespace BTCPayServer.AtomicSwaps
{
public class Preimage
{
public Preimage()
{
Bytes = RandomUtils.GetBytes(32);
}
public Preimage(byte[] bytes)
{
Bytes = bytes;
}
public byte[] Bytes
{
get; set;
}
public uint160 GetHash()
{
return new uint160(Hashes.Hash160(Bytes, Bytes.Length));
}
}
}