Security News
NIST Misses 2024 Deadline to Clear NVD Backlog
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
@ganache/rlp
Advanced tools
@ganache/rlp
Recursive Length Prefix Encoding for Node.js.
Based on https://github.com/ethereumjs/rlp, with some additional optimizations for encoding:
function encodeRange<
T extends EncodingInput | Readonly<EncodingInput>,
Start extends RangeOf<T["length"]>
>(
items: T,
start: Start,
length: Exclude<Remainders<T["length"], Start>, 0>
): { length: number; output: Buffer[] } {
//...;
}
Begin RLP encoding of items
, from start
until length
. Call RLP.digest
to
finish encoding.
Returns an object containing the total length
of all data in the encoded parts,
and output
, an array of encoded Buffers.
function digest(ranges: Readonly<Buffer[]>[], length: number) {
// ...
}
Finishes encoding started by encodeRange
.
Returns a Buffer of encoded data.
Additional changes:
encode
encode
only accepts buffers or nested buffer arrays, strings, number, bigint,
and BN support have been removed.These changes enable encoding data in chunks, avoiding processing the same inputs multiple times in common scenarios withing Ganache. Example:
type EthereumRawTx = [
nonce: Buffer,
gasPrice: Buffer,
gas: Buffer,
to: Buffer,
value: Buffer,
data: Buffer,
v: Buffer,
r: Buffer,
s: Buffer
];
// encode the first 6 entries
const partialRlp = encodeRange(raw, 0, 6);
// encode the last 3 entires
const signature = encodeRange(raw, 6, 3);
// combine all entries
const serialized = digest(
[partialRlp.output, signature.output],
partialRlp.length + signature.length
);
return {
// computing the `from` address requires entries 0-6
from: computeFromAddress(partialRlp, v.toNumber(), raw, chainId),
// hash requires entries 0-9
hash: Data.from(keccak(serialized), 32),
// serialized uses all entries for storage/transmission
serialized
};
FAQs
Recursive Length Prefix Encoding Module
The npm package @ganache/rlp receives a total of 21,296 weekly downloads. As such, @ganache/rlp popularity was classified as popular.
We found that @ganache/rlp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NIST has failed to meet its self-imposed deadline of clearing the NVD's backlog by the end of the fiscal year. Meanwhile, CVE's awaiting analysis have increased by 33% since June.
Security News
Cloudflare has launched a setup wizard allowing users to easily create and manage a security.txt file for vulnerability disclosure on their websites.
Security News
The Socket Research team breaks down a malicious npm package targeting the legitimate DOMPurify library. It uses obfuscated code to hide that it is exfiltrating browser and crypto wallet data.