scrypt

package
v0.0.78 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveKey

func DeriveKey(o []DeriveOptionsBuilder) ([]byte, error)

DeriveKey from the options provided.

Types

type DeriveOptionsBuilder

type DeriveOptionsBuilder func(*DeriveOpts)

DeriveOptionsBuilder creates the options to derive a key from scrypt.

func DefaultDeriveOptions

func DefaultDeriveOptions() DeriveOptionsBuilder

DefaultDeriveOptions for deriving an encryption.

func FromEncryptedKey

func FromEncryptedKey(length, n, p, r int, salt []byte) DeriveOptionsBuilder

FromEncryptedKey generate the options builder from an encrypted key.

func RandomSalt

func RandomSalt() (DeriveOptionsBuilder, error)

RandomSalt use a secure random number to use as the salt.

func WithPassphrase

func WithPassphrase(passphrase string) DeriveOptionsBuilder

WithPassphrase adds passphrase to the dervive options

type DeriveOpts

type DeriveOpts struct {
	Len        int    `json:"len"`
	N          int    `json:"n"`
	P          int    `json:"p"`
	R          int    `json:"r"`
	Salt       []byte `json:"salt"`
	Passphrase string `json:"-"`
}

DeriveOpts available for scrypt key derivation.

func CreateOptions

func CreateOptions(o []DeriveOptionsBuilder) *DeriveOpts

CreateOptions that can be stored.

func (DeriveOpts) KDF

func (d DeriveOpts) KDF() string

KDF name.

Jump to

Keyboard shortcuts

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