|
package scrub
|
|
|
|
import "testing"
|
|
|
|
func TestCryptHash(t *testing.T) {
|
|
var tests = []struct {
|
|
Test string
|
|
Want string
|
|
}{
|
|
{"$0$testing", "$0$*redacted*"},
|
|
{`$2a$06$/3OeRpbOf8/l6nPPRdZPp.nRiyYqPobEZGdNRBWihQhiFDh1ws1tu`, `$2a$*redacted*`},
|
|
{`$6$Np2eF8019ITolL$Q4ZB.EYJdr8nD8OyNPnOTuntLbZXl3YN5r49qtRZDd9JOR.5j1s6zQ7zPekxpVi1WEQ7pYB0AJkHU61Th6Ndf0`, `$6$*redacted*`},
|
|
{`$5$rounds=80000$wnsT7Yr92oJoP28r$cKhJImk5mfuSKV9b3mumNzlbstFUplKtQXXMo4G6Ep5`, `$5$*redacted*`},
|
|
{`$sha1$c6218$161d1ac8ab38979c5a31cbaba4a67378e7e60845`, `$sha1$*redacted*`},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.Want, func(t *testing.T) {
|
|
if scrubbed := CryptHash.Scrub(test.Test); scrubbed != test.Want {
|
|
t.Errorf("expected %q, got %q", test.Want, scrubbed)
|
|
}
|
|
})
|
|
}
|
|
}
|