crypto

package module
v0.0.0-...-b4b3d51 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2017 License: BSD-3-Clause Imports: 4 Imported by: 0

README

Documentation

Overview

Package crypto provides basic cryptographic routines.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClearSlice

func ClearSlice(buf ...[]byte)

ClearSlice will zero each provided slice.

func Equal

func Equal(a, b []byte) bool

Equal returns true if a == b using constant time comparison.

func EqualString

func EqualString(x, y string) bool

Equal returns true if x == y using constant time comparison.

func Key

func Key(pass, salt []byte) []byte

Key calls a standardized scrypt.Key.

N = 1 << 15 (32768)
r = 8
p = 1
keylen = 32

It panics if scrypt.Key panics, but that will only happen if the constants are invalid. (Which won't happen.)

func Shake256

func Shake256(data []byte) []byte

Shake256 calls sha3.ShakeSum256 with 64 bytes of output.

func Shake256s

func Shake256s(data string) []byte

Shake256 calls sha3.ShakeSum256 with 64 bytes of output.

Types

type Clearer

type Clearer struct {
	// contains filtered or unexported fields
}

Clearer allows deferred clearing of multiple slices while still allowing the slices to be used inside goroutines. Add should be called to add another reader to the Clearer. Once the slice is finished being used, Done should be called.

func NewClearer

func NewClearer(buf ...[]byte) *Clearer

NewClearer creates a new Clearer initialized with the provided byte slices.

func (*Clearer) Add

func (c *Clearer) Add()

func (*Clearer) Clear

func (c *Clearer) Clear()

Clear locks the Clearer and, if Clear has not already been executed, clears each slice it contains. Clear does not block so it need not be run in its own goroutine.

func (*Clearer) Done

func (c *Clearer) Done()

Directories

Path Synopsis
Package rng provides routines to create random integers.
Package rng provides routines to create random integers.
Timebox is a thin wrapper around nacl/secretbox for time-based secrets.
Timebox is a thin wrapper around nacl/secretbox for time-based secrets.
Tokens is a group of useful functions for creating cryptographically-secure tokens.
Tokens is a group of useful functions for creating cryptographically-secure tokens.
Package xsrf provides simple routines for creating and retrieving XSRF tokens with the Angular framework.
Package xsrf provides simple routines for creating and retrieving XSRF tokens with the Angular framework.

Jump to

Keyboard shortcuts

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