cnw

package
v0.0.0-...-7757972 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2016 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Chaffing-and-Winnowing.

This package implements Chaffing-and-Winnowing technology (http://people.csail.mit.edu/rivest/chaffing-980701.txt).

It outputs two Poly1305 MACs for each bit of input data: one valid, and other is not. MACs sequence is following:

MAC of 1st byte, 1st bit, 0 possible value
MAC of 1st byte, 1st bit, 1 possible value
MAC of 1st byte, 2nd bit, 0 possible value
MAC of 1st byte, 2nd bit, 1 possible value
...

If bit value is 0, then first MAC is taken over "1" and the second one is over "0". If bit value is 1, then first is taken over "0" and second is over "1".

Poly1305 uses 256-bit one-time key. We generate it using XSalsa20 for for the whole byte at once (16 MACs).

MACKey1, MACKey2, ... = XSalsa20(authKey, nonce, 0x00...)
nonce = prefix || 0x00... || big endian byte number

Index

Constants

View Source
const (
	EnlargeFactor = 16 * poly1305.TagSize
)

Variables

This section is empty.

Functions

func Chaff

func Chaff(authKey *[32]byte, noncePrfx, in []byte) []byte

Chaff the data. noncePrfx is 64-bit nonce. Output data will be much larger: 256 bytes for each input byte.

func Winnow

func Winnow(authKey *[32]byte, noncePrfx, in []byte) ([]byte, error)

Winnow the data.

Types

This section is empty.

Jump to

Keyboard shortcuts

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