当前位置: 首页>>代码示例>>C#>>正文


C# UInt256.ToByteArrayBE方法代码示例

本文整理汇总了C#中UInt256.ToByteArrayBE方法的典型用法代码示例。如果您正苦于以下问题:C# UInt256.ToByteArrayBE方法的具体用法?C# UInt256.ToByteArrayBE怎么用?C# UInt256.ToByteArrayBE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UInt256的用法示例。


在下文中一共展示了UInt256.ToByteArrayBE方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EncodeBlockHashTxIndex

        public static byte[] EncodeBlockHashTxIndex(UInt256 blockHash, int txIndex)
        {
            var blockHashTxIndexBytes = new byte[37];
            blockHashTxIndexBytes[0] = BLOCK_TX_PREFIX;
            blockHash.ToByteArrayBE(blockHashTxIndexBytes, 1);
            Buffer.BlockCopy(EncodeInt32(txIndex), 0, blockHashTxIndexBytes, 33, 4);

            return blockHashTxIndexBytes;
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:9,代码来源:DbEncoder.cs

示例2: EncodeUInt256

 public static byte[] EncodeUInt256(UInt256 value)
 {
     return value.ToByteArrayBE();
 }
开发者ID:cole2295,项目名称:BitSharp,代码行数:4,代码来源:DbEncoder.cs

示例3: MakeExistsKey

        private byte[] MakeExistsKey(UInt256 blockHash)
        {
            var key = new byte[33];
            key[0] = EXISTS_PREFIX;
            blockHash.ToByteArrayBE(key, 1);

            return key;
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:8,代码来源:LevelDbBlockTxesStorage.cs

示例4: MakeBlockInvalidKey

        private byte[] MakeBlockInvalidKey(UInt256 blockHash)
        {
            var key = new byte[33];
            key[0] = BLOCK_INVALID_PREFIX;
            blockHash.ToByteArrayBE(key, 1);

            return key;
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:8,代码来源:LevelDbBlockStorage.cs

示例5: MakeHeaderKey

        private byte[] MakeHeaderKey(UInt256 blockHash)
        {
            var key = new byte[33];
            key[0] = HEADER_PREFIX;
            blockHash.ToByteArrayBE(key, 1);

            return key;
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:8,代码来源:LevelDbBlockStorage.cs

示例6: MakeTotalWorkKey

        // TotalWork is stored in bytes as [prefix][totalWork big endian][blockHash big endian]
        // putting total work first ensures that entries are sorted by total work
        // including the blockHash ensures no coordination is needed to update the index
        private byte[] MakeTotalWorkKey(UInt256 blockHash, BigInteger totalWork)
        {
            if (totalWork < 0)
                throw new ArgumentOutOfRangeException(nameof(totalWork));

            var totalWorkBytes = totalWork.ToByteArray();
            if (totalWorkBytes.Length > 64)
                throw new ArgumentOutOfRangeException(nameof(totalWork));
            else if (totalWorkBytes.Length < 64)
                Array.Resize(ref totalWorkBytes, 64);

            Array.Reverse(totalWorkBytes);

            var key = new byte[1 + 64 + 32];
            key[0] = TOTAL_WORK_PREFIX;
            Buffer.BlockCopy(totalWorkBytes, 0, key, 1, 64);
            blockHash.ToByteArrayBE(key, 65);

            return key;
        }
开发者ID:cole2295,项目名称:BitSharp,代码行数:23,代码来源:LevelDbBlockStorage.cs


注:本文中的UInt256.ToByteArrayBE方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。