本文整理汇总了C#中NBitcoin.uint256.ToBytes方法的典型用法代码示例。如果您正苦于以下问题:C# uint256.ToBytes方法的具体用法?C# uint256.ToBytes怎么用?C# uint256.ToBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBitcoin.uint256
的用法示例。
在下文中一共展示了uint256.ToBytes方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CalculateChecksum
private static BitArray CalculateChecksum(uint256 blockId, int txIndex, int txOutIndex, Script scriptPubKey, int bitCount)
{
//All in little endian
var hashed =
blockId
.ToBytes(true)
.Concat(Utils.ToBytes((uint)txIndex, true))
.Concat(Utils.ToBytes((uint)txOutIndex, true))
.Concat(scriptPubKey.ToBytes(true))
.ToArray();
var hash = Hashes.Hash256(hashed);
var bytes = hash.ToBytes(true);
BitArray result = new BitArray(bitCount);
for(int i = 0 ; i < bitCount ; i++)
{
int byteIndex = i / 8;
int bitIndex = i % 8;
result.Set(i, ((bytes[byteIndex] >> bitIndex) & 1) == 1);
}
return result;
}
示例2: Insert
public void Insert(uint256 value)
{
if (value == null) throw new ArgumentNullException("value");
Insert(value.ToBytes());
}
示例3: Target
public Target(uint256 target)
{
_Target = new BigInteger(target.ToBytes());
_Target = new Target(this.ToCompact())._Target;
}
示例4: Contains
public bool Contains(uint256 hash)
{
if (hash == null) throw new ArgumentNullException("hash");
return Contains(hash.ToBytes());
}
示例5: WitScriptId
public WitScriptId(uint256 value)
: base(value.ToBytes())
{
}
示例6: Hash
private static uint256 Hash(uint256 a, uint256 b)
{
return Hashes.Hash256(a.ToBytes().Concat(b.ToBytes()).ToArray());
}
示例7: Contains
public bool Contains(uint256 hash)
{
return Contains(hash.ToBytes());
}
示例8: Insert
public void Insert(uint256 value)
{
Insert(value.ToBytes());
}