password

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 1 Imported by: 0

README

password

Go Report Card Go Reference License

Summary

Password hashing and checking using bcrypt.

Installation

go get github.com/jimrazmus/password

Usage

import github.com/jimrazmus/password

bcrypted, err := HashPassword("your_password")
if err != nil {
    log.Fatal(err)
}

// store 'bcrypted' somewhere for later use

// ... later ...

if !CheckPassword("your_password", bcrypted) {
    log.Fatal("Incorrect password")
}

Contributing

Please follow the Conventional Commits specification for your commit messages. Commit type options include: feat, fix, build, chore, ci, docs, style, refactor, perf, and test.

Open a pull request when you have completed your work and want it reviewed for inclusion.

Author

Jim Razmus II

License

This project is licensed under the MIT License - see the LICENSE.txt file for details.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPassword

func CheckPassword(password, hash string) bool

CheckPassword compares a password with a hashed result

func HashPassword

func HashPassword(password string) (string, error)

HashPassword encrypts a password for safe storage

Types

This section is empty.

Jump to

Keyboard shortcuts

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