salsa20

package
v0.0.0-...-50d29ed Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 22, 2019 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package salsa20 implements the Salsa20 stream cipher as specified in https://cr.yp.to/snuffle/spec.pdf.

Salsa20 differs from many other stream ciphers in that it is message orientated rather than byte orientated. Keystream blocks are not preserved between calls, therefore each side must encrypt/decrypt data with the same segmentation.

Another aspect of this difference is that part of the counter is exposed as a nonce in each call. Encrypting two different messages with the same (key, nonce) pair leads to trivial plaintext recovery. This is analogous to encrypting two different messages with the same key with a traditional stream cipher.

This package also implements XSalsa20: a version of Salsa20 with a 24-byte nonce as specified in https://cr.yp.to/snuffle/xsalsa-20081128.pdf. Simply passing a 24-byte slice as the nonce triggers XSalsa20.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func XORKeyStream

func XORKeyStream(out, in []byte, nonce []byte, key *[32]byte)

XORKeyStream crypts bytes from in to out using the given key and nonce. In and out must overlap entirely or not at all. Nonce must be either 8 or 24 bytes long.

Types

This section is empty.

Directories

Path Synopsis
Package salsa provides low-level access to functions in the Salsa family.
Package salsa provides low-level access to functions in the Salsa family.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL