Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

xsalsa20-encoding

Package Overview
Dependencies
Maintainers
3
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xsalsa20-encoding - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

6

index.js

@@ -109,3 +109,7 @@ const xsalsa20 = require('xsalsa20')

crypto.randomBytes(NONCE_BYTES).copy(nonce)
if ('function' === typeof opts.nonce) {
opts.nonce().slice(0, NONCE_BYTES).copy(nonce)
} else {
crypto.randomBytes(NONCE_BYTES).copy(nonce)
}

@@ -112,0 +116,0 @@ const xor = xsalsa20(nonce, key)

2

package.json
{
"name": "xsalsa20-encoding",
"version": "1.0.2",
"version": "1.1.0",
"description": "XSalsa20 codec that implements tha abstract-encoding interface.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -87,1 +87,11 @@ const blake2b = require('blake2b')

})
test('custom nonce', (t) => {
const key = crypto.randomBytes(32)
const nonce = crypto.randomBytes(24)
const codec = Codec(key, { nonce: () => nonce })
const plaintext = Buffer.from('hello')
const encoded = codec.encode(plaintext)
t.ok(0 === Buffer.compare(nonce, encoded.slice(0, 24)))
t.end()
})
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc