Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/exodusmovement/buffer-noise
Expand a buffer to a specified length.
https://github.com/exodusmovement/buffer-noise
Last synced: 8 days ago
JSON representation
Expand a buffer to a specified length.
- Host: GitHub
- URL: https://github.com/exodusmovement/buffer-noise
- Owner: ExodusMovement
- License: mit
- Created: 2017-04-05T20:20:49.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-05-12T23:00:11.000Z (over 1 year ago)
- Last Synced: 2024-04-14T13:10:04.025Z (7 months ago)
- Language: JavaScript
- Size: 12.7 KB
- Stars: 1
- Watchers: 31
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# buffer-noise
[![npm](https://img.shields.io/npm/v/buffer-noise.svg)](https://npmjs.com/package/buffer-noise)
[![GitHub Actions Status](https://img.shields.io/github/workflow/status/ExodusMovement/buffer-noise/CI/master)](https://github.com/ExodusMovement/buffer-noise/actions/workflows/ci.yml?query=branch%3Amaster)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
```js
const size = 25
const { expand, shrink } = require('buffer-noise')(size)const data = Buffer.from('Hello World!')
const newData = expand(data)
console.log(data, newData)
// Prints:
//
//
assert(newData.length === size)
assert(shrink(newData).equals(data))
```## License
MIT