C# 클래스 BitSharper.Utils

A collection of various utility methods that are helpful for working with the BitCoin protocol. To enable debug logging from the library, run with -Dbitcoinj.logging=true on your command line.
파일 보기 프로젝트 열기: TangibleCryptography/BitSharper

공개 메소드들

메소드 설명
BitcoinValueToFriendlyString ( long value ) : string

Returns the given value in nanocoins as a 0.12 type string.

BitcoinValueToFriendlyString ( ulong value ) : string

Returns the given value in nanocoins as a 0.12 type string.

BytesToHexString ( byte bytes ) : string

Returns the given byte array hex encoded.

DoubleDigest ( byte input ) : byte[]

See DoubleDigest(byte[], int, int).

DoubleDigest ( byte input, int offset, int length ) : byte[]

Calculates the SHA-256 hash of the given byte range, and then hashes the resulting hash again. This is standard procedure in BitCoin. The resulting hash is in big endian form.

DoubleDigestTwoBuffers ( byte input1, int offset1, int length1, byte input2, int offset2, int length2 ) : byte[]

Calculates SHA256(SHA256(byte range 1 + byte range 2)).

ReadUint16Be ( byte bytes, int offset ) : ushort
ReadUint32 ( byte bytes, int offset ) : uint
ReadUint32Be ( byte bytes, int offset ) : uint
ReverseBytes ( byte bytes ) : byte[]

Returns a copy of the given byte array in reverse order.

Sha256Hash160 ( byte input ) : byte[]

Calculates RIPEMD160(SHA256(input)). This is used in Address calculations.

ToNanoCoins ( string coins ) : ulong

Convert an amount expressed in the way humans are used to into nanocoins.

This takes string in a format understood by System.Double.Parse(string), for example "0", "1", "0.10", "1.23E3", "1234.5E-5".

ToNanoCoins ( uint coins, uint cents ) : ulong

Convert an amount expressed in the way humans are used to into nanocoins.

Uint32ToByteArrayBe ( uint val, byte @out, int offset ) : void
Uint32ToByteArrayLe ( uint val, byte @out, int offset ) : void
Uint32ToByteStreamLe ( uint val, Stream stream ) : void
Uint64ToByteStreamLe ( ulong val, Stream stream ) : void

비공개 메소드들

메소드 설명
DecodeCompactBits ( long compact ) : BigInteger
DecodeMpi ( byte mpi ) : BigInteger

MPI encoded numbers are produced by the OpenSSL BN_bn2mpi function. They consist of a 4 byte big endian length field, followed by the stated number of bytes representing the number in big endian format.

메소드 상세

BitcoinValueToFriendlyString() 공개 정적인 메소드

Returns the given value in nanocoins as a 0.12 type string.
public static BitcoinValueToFriendlyString ( long value ) : string
value long
리턴 string

BitcoinValueToFriendlyString() 공개 정적인 메소드

Returns the given value in nanocoins as a 0.12 type string.
public static BitcoinValueToFriendlyString ( ulong value ) : string
value ulong
리턴 string

BytesToHexString() 공개 정적인 메소드

Returns the given byte array hex encoded.
public static BytesToHexString ( byte bytes ) : string
bytes byte
리턴 string

DoubleDigest() 공개 정적인 메소드

See DoubleDigest(byte[], int, int).
public static DoubleDigest ( byte input ) : byte[]
input byte
리턴 byte[]

DoubleDigest() 공개 정적인 메소드

Calculates the SHA-256 hash of the given byte range, and then hashes the resulting hash again. This is standard procedure in BitCoin. The resulting hash is in big endian form.
public static DoubleDigest ( byte input, int offset, int length ) : byte[]
input byte
offset int
length int
리턴 byte[]

DoubleDigestTwoBuffers() 공개 정적인 메소드

Calculates SHA256(SHA256(byte range 1 + byte range 2)).
public static DoubleDigestTwoBuffers ( byte input1, int offset1, int length1, byte input2, int offset2, int length2 ) : byte[]
input1 byte
offset1 int
length1 int
input2 byte
offset2 int
length2 int
리턴 byte[]

ReadUint16Be() 공개 정적인 메소드

public static ReadUint16Be ( byte bytes, int offset ) : ushort
bytes byte
offset int
리턴 ushort

ReadUint32() 공개 정적인 메소드

public static ReadUint32 ( byte bytes, int offset ) : uint
bytes byte
offset int
리턴 uint

ReadUint32Be() 공개 정적인 메소드

public static ReadUint32Be ( byte bytes, int offset ) : uint
bytes byte
offset int
리턴 uint

ReverseBytes() 공개 정적인 메소드

Returns a copy of the given byte array in reverse order.
public static ReverseBytes ( byte bytes ) : byte[]
bytes byte
리턴 byte[]

Sha256Hash160() 공개 정적인 메소드

Calculates RIPEMD160(SHA256(input)). This is used in Address calculations.
public static Sha256Hash160 ( byte input ) : byte[]
input byte
리턴 byte[]

ToNanoCoins() 공개 정적인 메소드

Convert an amount expressed in the way humans are used to into nanocoins.
This takes string in a format understood by System.Double.Parse(string), for example "0", "1", "0.10", "1.23E3", "1234.5E-5".
If you try to specify fractional nanocoins.
public static ToNanoCoins ( string coins ) : ulong
coins string
리턴 ulong

ToNanoCoins() 공개 정적인 메소드

Convert an amount expressed in the way humans are used to into nanocoins.
public static ToNanoCoins ( uint coins, uint cents ) : ulong
coins uint
cents uint
리턴 ulong

Uint32ToByteArrayBe() 공개 정적인 메소드

public static Uint32ToByteArrayBe ( uint val, byte @out, int offset ) : void
val uint
@out byte
offset int
리턴 void

Uint32ToByteArrayLe() 공개 정적인 메소드

public static Uint32ToByteArrayLe ( uint val, byte @out, int offset ) : void
val uint
@out byte
offset int
리턴 void

Uint32ToByteStreamLe() 공개 정적인 메소드

public static Uint32ToByteStreamLe ( uint val, Stream stream ) : void
val uint
stream Stream
리턴 void

Uint64ToByteStreamLe() 공개 정적인 메소드

public static Uint64ToByteStreamLe ( ulong val, Stream stream ) : void
val ulong
stream Stream
리턴 void