micro-service web framework

发布时间 2023-11-01 17:54:36作者: PEAR2020

1. directory

2. generate model

3. MD5: asymmetric

salt: to prevent "brute force cracking" by using rainbow table

import  "github.com/anaskhan96/go-password-encoder" 

    // Using custom options
    options := &password.Options{16, 100, 30, sha512.New}
    salt, encodedPwd := password.Encode("generic password", options)
    newPwd := fmt.Sprintf("$sha512$%s$%s", salt, encodedPwd)
    pwdInfo := strings.Split(newPwd, "$")// len: 4; the first:""
    fmt.Println(pwdInfo[1]) 
    check := password.Verify("generic password", pwdInfo[2], pwdInfo[3], options)
    fmt.Println(check) // true