123456789101112131415161718192021222324252627282930313233 |
- package main
-
- import (
- "testing"
- )
-
- func TestHash(t *testing.T) {
- password := "kakka"
- hash := "gLXSSyQqG9PVMGM=$HAl9O6m3eRuhWZIo8TgqNJO92mdts8he32N7OnX3Q9A="
- ok, err := hashOk(password, hash)
- if err != nil {
- t.Fatal(err)
- }
- if !ok {
- t.Fatal("Could not hash password")
- }
- }
-
- func TestGeneratePasswordHash(t *testing.T) {
- password := "toni"
- hash, err := generateHash(password)
- if err != nil {
- t.Fatal("Error generating hash", err)
- }
- ok, err := hashOk(password, hash)
- if err != nil {
- t.Fatal("Error checking hash", err)
- }
- if !ok {
- t.Fatal("Did not match!")
- }
- }
|