Socket
Socket
Sign inDemoInstall

rlp

Package Overview
Dependencies
0
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.0.4 to 0.0.5

test/jsonTests/blockgenesistest.json

66

package.json
{
"name": "rlp",
"version": "0.0.4",
"description": "Recursive Length Prefix Encoding Module",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "./node_modules/mocha/bin/mocha --timeout 5000 --reporter spec ./test/"
},
"repository": {
"type": "git",
"url": "https://github.com/wanderer/rlp.git"
},
"keywords": [
"rlp",
"ethereum"
],
"contributors": [{
"name": "josephyzhou"
}
],
"author": {
"name": "null_radix",
"email": "null_radix@riseup.net"
},
"license": "GPL",
"bugs": {
"url": "https://github.com/wanderer/rlp/issues"
},
"devDependencies": {
"mocha": "~1.17.1"
"name": "rlp",
"version": "0.0.5",
"description": "Recursive Length Prefix Encoding Module",
"main": "index.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "./node_modules/mocha/bin/mocha --timeout 5000 --reporter spec ./test/"
},
"repository": {
"type": "git",
"url": "https://github.com/wanderer/rlp.git"
},
"keywords": [
"rlp",
"ethereum"
],
"contributors": [
{
"name": "josephyzhou"
}
],
"author": {
"name": "null_radix",
"email": "null_radix@riseup.net"
},
"license": "GPL",
"bugs": {
"url": "https://github.com/wanderer/rlp/issues"
},
"devDependencies": {
"mocha": "~1.17.1",
"bignum": "^0.7.0"
}
}
rlp [![Build Status](https://travis-ci.org/wanderer/rlp.png?branch=master)](https://travis-ci.org/wanderer/rlp)
===
[Recursive Length]( https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-RLP) Prefix Encoding for node.js based off of [josephyzhou](https://github.com/josephyzhou) implementation.
[Recursive Length]( https://github.com/ethereum/wiki/wiki/%5BEnglish%5D-RLP) Prefix Encoding for node.js.
Install

@@ -10,10 +9,4 @@ ======

Usage
=====
`encode` - RLP encodes an array, buffer or string and returns a buffer
`decode` - Decodes a RLP encoded buffer, array or string and returns a buffer or an array of buffers
Example
=======

@@ -30,3 +23,8 @@

```
API
=====
`rlp.encode(plain)` - RLP encodes an `Array`, `Buffer` or `String` and returns a `Buffer`
`rlp.decode(encoded)` - Decodes a RLP encoded `Buffer`, `Array` or `String` and returns a `Buffer` or an `Array` of `Buffers`
Tests

@@ -33,0 +31,0 @@ =====

var assert = require('assert');
var fs = require('fs');
var Bignum = require('bignum');
var RLP = require('../index.js');

@@ -149,1 +151,27 @@

});
describe('offical tests', function () {
var jsonTests;
before(function () {
var data = fs.readFileSync('./test/jsonTests/rlptest.json')
jsonTests = JSON.parse(data);
});
it('pass all tests', function (done) {
for (test in jsonTests) {
console.log(test);
var incoming = jsonTests[test].in
//if we are testing a big number
if(incoming[0] == '#'){
var bn = new Bignum(incoming.slice(1));
incoming = bn.toBuffer()
}
var encoded = RLP.encode(incoming);
assert.equal(encoded.toString('hex'), jsonTests[test].out.toLowerCase());
}
done();
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc