Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i get wrong secret #1

Open
tourer-zc opened this issue Jan 18, 2024 · 3 comments
Open

i get wrong secret #1

tourer-zc opened this issue Jan 18, 2024 · 3 comments

Comments

@tourer-zc
Copy link

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
Copy link
Owner

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

@mraksoll4
Copy link
Owner

mraksoll4 commented Jan 19, 2024

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))
}


@solardiz
Copy link

solardiz commented Oct 4, 2024

This is confusing yespower vs. yescrypt. What @mraksoll4 implemented here (thanks!) is yespower 0.5 (similar to yescrypt 0.5, which was a temporary revision during the Password Hashing Competition) and yespower 1.0. What @tourer-zc needs is proper yescrypt 1.0+ as implemented in https://github.com/openwall/yescrypt-go https://pkg.go.dev/github.com/openwall/yescrypt-go, which also has proper parameter decoding and proper base-64 crypt encoding (different from the usual base64).

In other words, what cryptocurrencies call yescrypt (retroactively named yespower 0.5) isn't the same as what we call yescrypt in password security context (yescrypt 1.0 release and on).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants