buffer-noise
Expand a buffer to a specified length. If the buffer is smaller than the specified length, the remaining space is filled with random bytes. A 32-bit Unsigned Big-Endian Integer containing the length of the data is always prepended to the buffer.
This module can be used for obfuscating an encrypted file's size for plausible deniability.
Installation
npm install buffer-noise
Usage
const size = 25
const { expand, shrink } = require('buffer-noise')(size)
const data = Buffer.from('Hello World!')
const newData = expand(data)
console.log(data, newData)
assert(newData.length === size)
assert(shrink(newData).equals(data))
License
MIT