mraksoll4 / yespower_go

implementation of yespower_go
MIT License
0 stars 0 forks source link

i get wrong secret #1

Open tourer-zc opened 7 months ago

tourer-zc commented 7 months ago

i have an encrypted data $y$j9T$nUQ1haLSJODMAlSVUV5NGUw.$tLzBKbQ6ujjnayVUk2/GG1OjhWMqoVJ/05fXYhZH0QD, the real password is Hillstone!1. But i can not get the encrypted data with the follwing code:

package main

import (
    "encoding/base64"
    "encoding/hex"
    "fmt"
)

func main() {
    newsalt, _ := base64.RawURLEncoding.DecodeString("nUQ1haLSJODMAlSVUV5NGUw.")
    newpass := []byte("Hillstone!1")

    pass := Yescrypt(newpass, 4096, 32, string(newsalt))
    byt, _ := hex.DecodeString(pass)
    encoded := base64.StdEncoding.EncodeToString(byt)
    fmt.Println(encoded, len(encoded))
}

Could you tell me what's wrong in my code?

mraksoll4 commented 7 months ago

and you can try uncoment this for see what hapening. image

mraksoll4 commented 7 months ago
package main

import (
    "encoding/base64"
    "encoding/hex"
    "fmt"

    "github.com/mraksoll4/yespower_go"
)

func main() {
    newsalt, _ := base64.RawURLEncoding.DecodeString("nUQ1haLSJODMAlSVUV5NGUw.")
    newpass := []byte("Hillstone!1")

    pass := yespower.Yescrypt(newpass, 4096, 32, string(newsalt))
    byt, _ := hex.DecodeString(pass)
    encoded := base64.StdEncoding.EncodeToString(byt)
    fmt.Println(encoded, len(encoded))
}