Compare commits
No commits in common. "bd72a9b11d0e1db865e8c32156843f477027cfa2" and "c216e4903904f76dc6f10449eba38d15ad7660c1" have entirely different histories.
bd72a9b11d
...
c216e49039
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,3 +1 @@
|
|||||||
test
|
test
|
||||||
.kdev4
|
|
||||||
.vscode
|
|
||||||
|
40
README.md
40
README.md
@ -11,38 +11,28 @@ go get github.com/GRMrGecko/go-passwd
|
|||||||
## Example
|
## Example
|
||||||
|
|
||||||
```go
|
```go
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/GRMrGecko/go-passwd"
|
"log"
|
||||||
"log"
|
"github.com/GRMrGecko/go-passwd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
result, err := passwd.CheckPassword([]byte("$y$j9T$Q3N1jZa3Cp.yNINNDt5dDgYkHU7k$9o7WJJB5F.tTEhZdz6T6LMWY/0C3JkhvmcNyUPvUBlC"), []byte("Test"))
|
result, err := passwd.CheckPassword([]byte("$y$j9T$Q3N1jZa3Cp.yNINNDt5dDgYkHU7k$9o7WJJB5F.tTEhZdz6T6LMWY/0C3JkhvmcNyUPvUBlC"), []byte("Test"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if result {
|
if result {
|
||||||
log.Println("Password confirmed, saving new password.")
|
log.Println("Password confirmed, saving new password.")
|
||||||
|
|
||||||
pw := passwd.NewSHA512CryptPasswd()
|
pw := passwd.NewSHA512CryptPasswd()
|
||||||
hash, err := pw.HashPassword([]byte("New Password!!!"))
|
hash, err := pw.HashPassword([]byte("New Password!!!"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
log.Println("The new password hash to save is:", string(hash))
|
log.Println("The new password hash to save is:", string(hash))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
Example output:
|
|
||||||
```
|
|
||||||
$ ./test
|
|
||||||
2024/09/07 18:42:35 Password confirmed, saving new password.
|
|
||||||
2024/09/07 18:42:35 The new password hash to save is: $6$4Eu/l5e.otcRj0rJ$YAlwxJD9pZY9.Z2TjseCbkXiUIrFU2AXh9DPEm5Z1SagxP..xaQCsz7jAgfW4nmUbLh.o23pEZGvvxPCLltf11
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Known issues
|
## Known issues
|
||||||
|
Loading…
Reference in New Issue
Block a user