Socket
Socket
Sign inDemoInstall

xsalsa20

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    xsalsa20

XSalsa20 implemented in Javascript and WebAssembly


Version published
Weekly downloads
19K
decreased by-20.29%
Maintainers
1
Install size
47.0 kB
Created
Weekly downloads
 

Readme

Source

xsalsa20

XSalsa20 implemented in Javascript and WebAssembly.

npm install xsalsa20

build status

Usage

var crypto = require('crypto')
var xsalsa20 = require('xsalsa20')
var key = crypto.randomBytes(32)
var nonce = crypto.randomBytes(24)

var xor = xsalsa20(nonce, key)

console.log(xor.update(Buffer.from('hello')))
console.log(xor.update(Buffer.from('world')))

xor.finalize()

API

var xor = xsalsa20(nonce, key)

Create a new xor instance.

Nonce should be a 24 byte buffer/uint8array and key should be 32 bytes.

var output = xor.update(input, [output])

Update the xor instance with a new input buffer. Optionally you can pass in an output buffer.

xor.finalize()

Call this method last. Clears internal state.

Contributing

The bulk of this module is implemented in WebAssembly in the xsalsa20.wat file. To build the thin Javascript wrapper do:

npm run compile

License

MIT

FAQs

Last updated on 22 Nov 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc