cutil

package
v0.0.0-...-835eb37 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConstantTimeCompare

func ConstantTimeCompare(d1, d2 []byte) bool

ConstantTimeCompare checks if two slices are equal and returns true if they are, false otherwise. It uses constant-time comparison. It's not contant time when len(d1) != len(d2)

Types

type NonceCounter

type NonceCounter []uint8

NonceCounter is preallocated slice of specified size, which can be efficiently incremented by one in order to produce unique nonces for data encryption.

NOTE: NocneCounter IS NOT CONSTANT TIME!!! Be aware that this counter leaks(or may leak) count of chunks encrypted already. Usually this is not problem, since attacker knows anyway how many chunks were encrypted.

func NonceCounterForAEAD

func NonceCounterForAEAD(aead cipher.AEAD) NonceCounter

NonceCounterForAEAD creates nonce counter appropriate for specified AEAD cipher.

func (NonceCounter) Increment

func (nonce NonceCounter) Increment() (err error)

Increment assigns next unique value to this nonce counter. If it's not possible without overflowing or changing nonce size then error is returned.

func (NonceCounter) Len

func (nonce NonceCounter) Len() int

Len retuns size of nonce generated by this nonce counter.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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