forked from TrueCloudLab/rclone
vendor: github.com/abbot/go-http-auth for #1802
This commit is contained in:
parent
5530662ccc
commit
2b6f7028a6
23 changed files with 1597 additions and 2 deletions
19
vendor/github.com/abbot/go-http-auth/md5crypt_test.go
generated
vendored
Normal file
19
vendor/github.com/abbot/go-http-auth/md5crypt_test.go
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
package auth
|
||||
|
||||
import "testing"
|
||||
|
||||
func Test_MD5Crypt(t *testing.T) {
|
||||
test_cases := [][]string{
|
||||
{"apache", "$apr1$J.w5a/..$IW9y6DR0oO/ADuhlMF5/X1"},
|
||||
{"pass", "$1$YeNsbWdH$wvOF8JdqsoiLix754LTW90"},
|
||||
{"topsecret", "$apr1$JI4wh3am$AmhephVqLTUyAVpFQeHZC0"},
|
||||
}
|
||||
for _, tc := range test_cases {
|
||||
e := NewMD5Entry(tc[1])
|
||||
result := MD5Crypt([]byte(tc[0]), e.Salt, e.Magic)
|
||||
if string(result) != tc[1] {
|
||||
t.Fatalf("MD5Crypt returned '%s' instead of '%s'", string(result), tc[1])
|
||||
}
|
||||
t.Logf("MD5Crypt: '%s' (%s%s$) -> %s", tc[0], e.Magic, e.Salt, result)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue