(t *testing.T)
| 22 | ) |
| 23 | |
| 24 | func TestPasswordHashing(t *testing.T) { |
| 25 | bcryptTests := []struct { |
| 26 | plaintext []byte |
| 27 | hash []byte |
| 28 | }{ |
| 29 | { |
| 30 | plaintext: []byte("password"), |
| 31 | hash: []byte("$2a$14$uALAQb/Lwl59oHVbuUa5m.xEFmQBc9ME/IiSgJK/VHtNJJXASCDoS"), |
| 32 | }, |
| 33 | } |
| 34 | |
| 35 | for _, tt := range bcryptTests { |
| 36 | hashed, err := HashPassword(tt.plaintext) |
| 37 | if err != nil { |
| 38 | t.Error(err) |
| 39 | } |
| 40 | |
| 41 | if err = CheckPasswordHash(hashed, tt.plaintext); err != nil { |
| 42 | t.Error(err) |
| 43 | } |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | // Benchmarks SHA256 on 16K of random data. |
| 48 | func BenchmarkSHA256(b *testing.B) { |
nothing calls this directly
no test coverage detected