@sec-block/secjs-rlp
secjs blockchain rlp lib
Last updated 2 years ago by abysmli .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @sec-block/secjs-rlp 
SYNC missed versions from official npm registry.

JavaScript Style Guide

[JavaScript Style Guide]


SECRlpEncode

This package is used for SEC blockchain rlp encoding.


new SECRlpEncode(config)

new SECRlpEncode(config) Constructs a rlp encode class.

Param Type Description
config TBD TBD, will be implemented in the future

Example

const RLP = require('encode.js')

const rlp = new RLP()

SECRlpEncode.encode(input, buffer, offset) ⇒ Buffer

Returns input in RLP encoded format

Param Type Description
input {Buffer, String, Integer, Array} Input data for RLP encode
buffer {Buffer} Input buffer which is in RLP encoded format
offset {Buffer} Buffer offset position

SECRlpEncode.decode(input, start, end) ⇒ Array

RLP decode for input data

Param Type Description
input {Buffer, String, Integer, Array} Input should be in RLP encoded structure
start {Integer} "input" data array starting index
end {Integer} "input" data array ending index

SECRlpEncode.getLength(input) ⇒ Number

Returns input's length according to the first several indication bytes

Param Type Description
input {Buffer, String, Integer, Array} Input should be in RLP encoded data, or the returned length is wrong

中文简介:

本库函数用于SEC区块链的RLP编码 RLP编码用于存储和传输数据,处理数据则用.json格式文件 json文件由RLP编码过以后,由于json文件的键值被去掉了,仅保留内容,因此剩下了大量的空间

主要的函数:

  1. RLP编码: encode(input, buffer, offset) => Buffer 输入"input"可以是{Buffer,String,Integer,Array},RLP编码仅对两种数据结构进行处理:列表及字符串 Nodejs中Array即为列表,其他类型{Buffer,String,Integer}作为字符串处理 该函数的输出结果为RLP编码后的input,类型为Buffer

  2. RLP解码:decode(input, start, end) => Array 输入"input"可以是{Buffer,String,Integer,Array},无论哪种类型,都会被先转换为Buffer类型再进行处理 作用与encode相反,将RLP格式的数据进行解码, 输出为Array类型

  3. 获取长度函数: getLength(input) => Number input为经过RLP编码后的数据 函数根据前几个字节的值获取整个input数据的长度

Current Tags

  • 1.1.10                                ...           latest (2 years ago)

15 Versions

  • 1.1.10                                ...           2 years ago
  • 1.1.9                                ...           2 years ago
  • 1.1.7                                ...           2 years ago
  • 1.1.8                                ...           2 years ago
  • 1.1.6                                ...           2 years ago
  • 1.1.5                                ...           2 years ago
  • 1.1.4                                ...           2 years ago
  • 1.1.3                                ...           2 years ago
  • 1.1.2                                ...           2 years ago
  • 1.1.1                                ...           2 years ago
  • 1.1.0                                ...           2 years ago
  • 1.0.5                                ...           2 years ago
  • 1.0.4                                ...           2 years ago
  • 1.0.3                                ...           2 years ago
  • 1.0.2                                ...           2 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 2
Last Month 3
Dependencies (1)
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |