C# 클래스 Nethereum.ABI.Util.RLP.RLP

Recursive Length Prefix (RLP) encoding.

The purpose of RLP is to encode arbitrarily nested arrays of binary data, and RLP is the main encoding method used to serialize objects in Ethereum. The only purpose of RLP is to encode structure; encoding specific atomic data types (eg. strings, integers, floats) is left up to higher-order protocols; in Ethereum the standard is that integers are represented in big endian binary form. If one wishes to use RLP to encode a dictionary, the two suggested canonical forms are to either use [[k1,v1],[k2,v2]...] with keys in lexicographic order or to use the higher-level Patricia Tree encoding as Ethereum does.

The RLP encoding function takes in an item. An item is defined as follows:

- A string (ie. byte array) is an item - A list of items is an item

For example, an empty string is an item, as is the string containing the word "cat", a list containing any number of strings, as well as more complex data structures like ["cat",["puppy","cow"],"horse",[[]],"pig",[""],"sheep"]. Note that in the context of the rest of this article, "string" will be used as a synonym for "a certain number of bytes of binary data"; no special encodings are used and no knowledge about the content of the strings is implied.

See:

https://github.com/ethereum/wiki/wiki/RLP
파일 보기 프로젝트 열기: Nethereum/Nethereum

공개 프로퍼티들

프로퍼티 타입 설명
EMPTY_BYTE_ARRAY byte[]
ZERO_BYTE_ARRAY byte[]

공개 메소드들

메소드 설명
ByteArrayToInt ( byte bytes ) : int
Decode ( byte msgData ) : RLPCollection

Parses byte[] message into RLP items

Decode ( byte msgData, int level, int startPosition, int endPosition, int levelToIndex, RLPCollection rlpCollection ) : void

Decodes a message from a starting point to an end point

DecodeFirstElement ( byte msgData, int startPos ) : IRLPElement
EncodeByte ( byte singleByte ) : byte[]
EncodeElement ( byte srcData ) : byte[]
EncodeList ( ) : byte[]
IsNullOrZeroArray ( byte array ) : bool
IsSingleZero ( byte array ) : bool

비공개 메소드들

메소드 설명
CalculateLength ( int lengthOfLength, byte msgData, int pos ) : int

메소드 상세

ByteArrayToInt() 공개 정적인 메소드

public static ByteArrayToInt ( byte bytes ) : int
bytes byte
리턴 int

Decode() 공개 정적인 메소드

Parses byte[] message into RLP items
public static Decode ( byte msgData ) : RLPCollection
msgData byte raw RLP data
리턴 RLPCollection

Decode() 공개 정적인 메소드

Decodes a message from a starting point to an end point
public static Decode ( byte msgData, int level, int startPosition, int endPosition, int levelToIndex, RLPCollection rlpCollection ) : void
msgData byte
level int
startPosition int
endPosition int
levelToIndex int
rlpCollection RLPCollection
리턴 void

DecodeFirstElement() 공개 정적인 메소드

public static DecodeFirstElement ( byte msgData, int startPos ) : IRLPElement
msgData byte
startPos int
리턴 IRLPElement

EncodeByte() 공개 정적인 메소드

public static EncodeByte ( byte singleByte ) : byte[]
singleByte byte
리턴 byte[]

EncodeElement() 공개 정적인 메소드

public static EncodeElement ( byte srcData ) : byte[]
srcData byte
리턴 byte[]

EncodeList() 공개 정적인 메소드

public static EncodeList ( ) : byte[]
리턴 byte[]

IsNullOrZeroArray() 공개 정적인 메소드

public static IsNullOrZeroArray ( byte array ) : bool
array byte
리턴 bool

IsSingleZero() 공개 정적인 메소드

public static IsSingleZero ( byte array ) : bool
array byte
리턴 bool

프로퍼티 상세

EMPTY_BYTE_ARRAY 공개적으로 정적으로 프로퍼티

public static byte[] EMPTY_BYTE_ARRAY
리턴 byte[]

ZERO_BYTE_ARRAY 공개적으로 정적으로 프로퍼티

public static byte[] ZERO_BYTE_ARRAY
리턴 byte[]