pbkdf2

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2021 License: Apache-2.0 Imports: 3 Imported by: 32

README

Go Reference Go Report Card Github Actions

pbkdf2 – Go implementation of PBKDF2

Description

Package pbkdf2 provides password-based key derivation based on RFC 8018.

Copyright 2021 by David A. Golden. All rights reserved.

Licensed under the Apache License, Version 2.0 (the "License"). You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Documentation

Overview

Package pbkdf2 implements password-based key derivation using the PBKDF2 algorithm described in RFC 2898 and RFC 8018.

It provides a drop-in replacement for `golang.org/x/crypto/pbkdf2`, with the following benefits:

- Released as a module with semantic versioning

- Does not pull in dependencies for unrelated `x/crypto/*` packages

- Supports Go 1.9+

See https://tools.ietf.org/html/rfc8018#section-4 for security considerations in the selection of a salt and iteration count.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Key

func Key(password, salt []byte, iterCount, keyLen int, h func() hash.Hash) []byte

Key generates a derived key from a password using the PBKDF2 algorithm. The inputs include salt bytes, the iteration count, desired key length, and a constructor for a hashing function. For example, for a 32-byte key using SHA-256:

key := Key([]byte("trustNo1"), salt, 10000, 32, sha256.New)

Types

This section is empty.

Jump to

Keyboard shortcuts

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