authstring

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2023 License: MIT Imports: 5 Imported by: 0

README

AuthString

GitHub Go Reference

Password Hashing Library

Usage

package main

import (
  "fmt"

  "github.com/lemon-mint/authstring"
)

func main() {
  hash := authstring.AuthString([]byte("password"))
  fmt.Println(hash) // Ag....

  ok, upgrade := authstring.VerifyAuthString([]byte("password"), hash)
  if !ok {
    panic("Failed to verify password")
  }

  _ = upgrade
  // if upgrade {
  //   hash = authstring.AuthString([]byte("password"))
  //   db.UpdateUserPassword("username", hash)
  // }
}

Go Playground

Documentation

Index

Constants

View Source
const (
	ALG_PBKDF2_V1   = uint16(algs.PBKDF2_V1)
	ALG_ARGON2ID_V1 = uint16(algs.ARGON2ID_V1)
)

Variables

This section is empty.

Functions

func AuthString

func AuthString(password []byte) string

func AuthStringWithAlgorithm

func AuthStringWithAlgorithm(password []byte, algorithm uint16) string

func VerifyAuthString

func VerifyAuthString(password []byte, hash string) (ok bool, needUpgrade bool)

Types

This section is empty.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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