increment-buffer
increment a buffer (with carry)
Last updated 8 years ago by dominictarr .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install increment-buffer 
SYNC missed versions from official npm registry.

increment-buffer

increment a buffer (with carry)

Example

Useful for managing nonces when using libsodium In particular, see Notes section regarding reusing keys (scroll to bottom)

> var inc = require('increment-buffer')
> inc(new Buffer([0, 0, 0, 0]))
<Buffer 00 00 00 01>

> //with carry...
> inc(new Buffer([0, 0, 0, 255]))
<Buffer 00 00 01 00>

> //wrap around
> inc(new Buffer([255, 255, 255, 255]))
<Buffer 00 00 00 00>

License

MIT

Current Tags

  • 1.0.1                                ...           latest (8 years ago)

2 Versions

  • 1.0.1                                ...           8 years ago
  • 1.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (1)
Dependents (2)

Copyright 2013 - present © cnpmjs.org | Home |