Argon2id the most secure password hashing algorithm | Golang Argon2 Hash | Secure Password Hashing

Опубликовано: 11 Ноябрь 2024
на канале: Maharlikans Code
1,451
18

Argon2 is a key derivation function that was selected as the winner of the Password Hashing Competition in July 2015. It was designed by Alex Biryukov, Daniel Dinu, and Dmitry Khovratovich from the University of Luxembourg

#MaharlikansCode
#Argon2id
#GolangTutorial
#Golang
#SecuredPasswordHash
#LifeAsSoftwareDeveloper
#Maharlikans
#FilipinoSoftwareDeveloper

If you go with extra mile for buying me a cup of coffee, I appreciate it guys: https://ko-fi.com/maharlikanscode
or shop at https://maharlikanscode.myspreadshop....

References:
https://en.wikipedia.org/wiki/Argon2
https://github.com/P-H-C/phc-winner-a...
https://pkg.go.dev/golang.org/x/crypt...
https://www.alexedwards.net/blog/how-...

Install PWD: https://github.com/itrepablik/pwd

How to use it?
This is how you can use the simplified argon2id in your next Go project.

package main

import (
"github.com/itrepablik/pwd"
)

func init() {
// Customize the Argon2id settings
pwd.SetArgon2Configs(128*1024, 1, 2, 32, 32)
}

func main() {
errInfo := ""

// Generate Argon2id secured hash password
argon2Hash, err := pwd.HashAndSalt("yourPlainPassword")
if err != nil {
errInfo = fmt.Sprintf("error hashing password: %s", err.Error())
log.Fatal(errInfo)
return
}
fmt.Println("argon2Hash: ", argon2Hash)

// Validate Argon2id secured hash password
isPwdCorrect, err := pwd.CheckPasswordHash("yourPlainPassword", argon2Hash)
if err != nil {
errInfo := fmt.Sprintf("error checking password: %s", err.Error())
log.Fatal(errInfo)
return
}
fmt.Println("Password is correct:", isPwdCorrect)
}