rlp
Advanced tools
Comparing version 0.0.4 to 0.0.5
{ | ||
"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(); | ||
}); | ||
}); |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
59006
16
1449
2
32
1
1