@nomicfoundation/ethereumjs-rlp
Advanced tools
Comparing version 4.0.3 to 5.0.0
@@ -8,3 +8,3 @@ export declare type Input = string | number | bigint | Uint8Array | Array<Input> | null | undefined; | ||
/** | ||
* RLP Encoding based on https://eth.wiki/en/fundamentals/rlp | ||
* RLP Encoding based on https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ | ||
* This function takes in data, converts it to Uint8Array if not, | ||
@@ -17,3 +17,3 @@ * and adds a length for recursion. | ||
/** | ||
* RLP Decoding based on https://eth.wiki/en/fundamentals/rlp | ||
* RLP Decoding based on https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ | ||
* @param input Will be converted to Uint8Array | ||
@@ -20,0 +20,0 @@ * @param stream Is the input a stream (false by default) |
@@ -5,3 +5,3 @@ "use strict"; | ||
/** | ||
* RLP Encoding based on https://eth.wiki/en/fundamentals/rlp | ||
* RLP Encoding based on https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ | ||
* This function takes in data, converts it to Uint8Array if not, | ||
@@ -15,7 +15,9 @@ * and adds a length for recursion. | ||
const output = []; | ||
let outputLength = 0; | ||
for (let i = 0; i < input.length; i++) { | ||
output.push(encode(input[i])); | ||
const encoded = encode(input[i]); | ||
output.push(encoded); | ||
outputLength += encoded.length; | ||
} | ||
const buf = concatBytes(...output); | ||
return concatBytes(encodeLength(buf.length, 192), buf); | ||
return concatBytes(encodeLength(outputLength, 192), ...output); | ||
} | ||
@@ -22,0 +24,0 @@ const inputBuf = toBytes(input); |
{ | ||
"name": "@nomicfoundation/ethereumjs-rlp", | ||
"version": "4.0.3", | ||
"version": "5.0.0", | ||
"description": "Recursive Length Prefix Encoding Module", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -9,3 +9,3 @@ # @ethereumjs/rlp | ||
[Recursive Length Prefix](https://eth.wiki/en/fundamentals/rlp) encoding for Node.js and the browser. | ||
[Recursive Length Prefix](https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp) encoding for Node.js and the browser. | ||
@@ -12,0 +12,0 @@ ## Installation |
@@ -11,3 +11,3 @@ export type Input = string | number | bigint | Uint8Array | Array<Input> | null | undefined | ||
/** | ||
* RLP Encoding based on https://eth.wiki/en/fundamentals/rlp | ||
* RLP Encoding based on https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ | ||
* This function takes in data, converts it to Uint8Array if not, | ||
@@ -21,7 +21,9 @@ * and adds a length for recursion. | ||
const output: Uint8Array[] = [] | ||
let outputLength = 0 | ||
for (let i = 0; i < input.length; i++) { | ||
output.push(encode(input[i])) | ||
const encoded = encode(input[i]) | ||
output.push(encoded) | ||
outputLength += encoded.length | ||
} | ||
const buf = concatBytes(...output) | ||
return concatBytes(encodeLength(buf.length, 192), buf) | ||
return concatBytes(encodeLength(outputLength, 192), ...output) | ||
} | ||
@@ -71,3 +73,3 @@ const inputBuf = toBytes(input) | ||
/** | ||
* RLP Decoding based on https://eth.wiki/en/fundamentals/rlp | ||
* RLP Decoding based on https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/ | ||
* @param input Will be converted to Uint8Array | ||
@@ -74,0 +76,0 @@ * @param stream Is the input a stream (false by default) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
51520
557