package scrypt import ( g "gobang" ) func MainTest() { g.Testing("from a known input we check the hash", func() { var ( password = []byte("a fixed password") salt = []byte("a fixed salt____________________") ) hashInput := HashInput{ Password: password, Salt: salt, } hash, err := Hash(hashInput) g.TErrorIf(err) checkInput := CheckInput{ Password: password, Salt: salt, Hash: hash, } ok, err := Check(checkInput) g.TErrorIf(err) g.TAssertEqual(ok, true) }) g.Testing("we can genereate a hash and check it is equal", func() { password, err := Salt() g.TErrorIf(err) salt, err := Salt() g.TErrorIf(err) hashInput := HashInput{ Password: password, Salt: salt, } hash, err := Hash(hashInput) g.TErrorIf(err) checkInput := CheckInput{ Password: password, Salt: salt, Hash: hash, } ok, err := Check(checkInput) g.TErrorIf(err) g.TAssertEqual(ok, true) }) }