Comparing version 1.1.2 to 2.0.0
@@ -208,3 +208,7 @@ const assert = require('assert') | ||
if (typeof v === 'string') { | ||
v = new Buffer(padToEven(stripHexPrefix(v)), 'hex') | ||
if (isHexPrefixed(v)) { | ||
v = new Buffer(padToEven(stripHexPrefix(v)), 'hex') | ||
} else { | ||
v = new Buffer(v) | ||
} | ||
} else if (typeof v === 'number') { | ||
@@ -211,0 +215,0 @@ if (!v) { |
{ | ||
"name": "rlp", | ||
"version": "1.1.2", | ||
"version": "2.0.0", | ||
"description": "Recursive Length Prefix Encoding Module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -18,3 +18,3 @@ const assert = require('assert') | ||
it('should return itself if single byte and less than 0x7f:', function () { | ||
var encodedSelf = RLP.encode(new Buffer('a')) | ||
var encodedSelf = RLP.encode('a') | ||
assert.equal(encodedSelf.toString(), 'a') | ||
@@ -24,3 +24,3 @@ }) | ||
it('length of string 0-55 should return (0x80+len(data)) plus data', function () { | ||
var encodedDog = RLP.encode(new Buffer('dog')) | ||
var encodedDog = RLP.encode('dog') | ||
assert.equal(4, encodedDog.length) | ||
@@ -34,3 +34,3 @@ assert.equal(encodedDog[0], 131) | ||
it('length of string >55 should return 0xb7+len(len(data)) plus len(data) plus data', function () { | ||
var encodedLongString = RLP.encode(new Buffer('zoo255zoo255zzzzzzzzzzzzssssssssssssssssssssssssssssssssssssssssssssss')) | ||
var encodedLongString = RLP.encode('zoo255zoo255zzzzzzzzzzzzssssssssssssssssssssssssssssssssssssssssssssss') | ||
assert.equal(72, encodedLongString.length) | ||
@@ -47,3 +47,3 @@ assert.equal(encodedLongString[0], 184) | ||
it('length of list 0-55 should return (0xc0+len(data)) plus data', function () { | ||
var encodedArrayOfStrings = RLP.encode([new Buffer('dog'), new Buffer('god'), new Buffer('cat')]) | ||
var encodedArrayOfStrings = RLP.encode(['dog', 'god', 'cat']) | ||
assert.equal(13, encodedArrayOfStrings.length) | ||
@@ -135,8 +135,4 @@ assert.equal(encodedArrayOfStrings[0], 204) | ||
var bufString = testString.map(function (i) { | ||
return new Buffer(i) | ||
}) | ||
it('should encode it', function () { | ||
encoded = RLP.encode(bufString) | ||
encoded = RLP.encode(testString) | ||
}) | ||
@@ -267,3 +263,3 @@ | ||
var b = RLP.encode('88f') | ||
assert.equal(a.toString('hex'), b.toString('hex')) | ||
assert.notEqual(a.toString('hex'), b.toString('hex')) | ||
}) | ||
@@ -270,0 +266,0 @@ }) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
457
0
41012
7