|
|
@@ -160,5 +160,23 @@ func TestLengthEncodedInteger(t *testing.T) {
|
|
|
t.Errorf("%v: expected %x, got %x", num, tst.encoded, encoded)
|
|
|
}
|
|
|
}
|
|
|
+}
|
|
|
|
|
|
+func TestOldPass(t *testing.T) {
|
|
|
+ scramble := []byte{9, 8, 7, 6, 5, 4, 3, 2}
|
|
|
+ vectors := []struct {
|
|
|
+ pass string
|
|
|
+ out string
|
|
|
+ }{
|
|
|
+ {" pass", "47575c5a435b4251"},
|
|
|
+ {"pass ", "47575c5a435b4251"},
|
|
|
+ {"123\t456", "575c47505b5b5559"},
|
|
|
+ {"C0mpl!ca ted#PASS123", "5d5d554849584a45"},
|
|
|
+ }
|
|
|
+ for _, tuple := range vectors {
|
|
|
+ ours := scrambleOldPassword(scramble, []byte(tuple.pass))
|
|
|
+ if tuple.out != fmt.Sprintf("%x", ours) {
|
|
|
+ t.Errorf("Failed old password %q", tuple.pass)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|