MCPcopy Create free account
hub / github.com/dwin/goSecretBoxPassword / TestUpdateMasterBadVersion

Function TestUpdateMasterBadVersion

password_test.go:223–243  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

221 }
222}
223func TestUpdateMasterBadVersion(t *testing.T) {
224 output, err := Hash("password1234", "masterpassphrase", 0, ScryptParams{N: 32768, R: 16, P: 1}, DefaultParams)
225 if err != nil {
226 t.Log(err)
227 t.FailNow()
228 }
229 fmt.Println("Output: " + output)
230 fmt.Printf("Length: %v\n", len(output))
231
232 err = Verify("password1234", "masterpassphrase", output)
233 if err != nil {
234 t.Log(err)
235 t.FailNow()
236 }
237 // Update then re-verify
238 _, err = UpdateMaster("masterpassphrase2", "masterpassphrase", 0, output, DefaultParams)
239 if err != ErrInvalidVersionUpdate {
240 t.Log("Expected Invalid Version update error")
241 t.FailNow()
242 }
243}
244func TestHashShortPassphrase(t *testing.T) {
245 // Errors should not be nil, fail if errors nil
246 _, err := Hash("pass", "masterpassphrase", 0, ScryptParams{N: 32768, R: 16, P: 1}, DefaultParams)

Callers

nothing calls this directly

Calls 3

HashFunction · 0.85
VerifyFunction · 0.85
UpdateMasterFunction · 0.85

Tested by

no test coverage detected