diff --git a/openpgp/s2k/s2k.go b/openpgp/s2k/s2k.go index c8b9bbd..c466a8d 100644 --- a/openpgp/s2k/s2k.go +++ b/openpgp/s2k/s2k.go @@ -97,12 +97,12 @@ func Parse(r io.Reader) (f func(out, in []byte), err error) { } switch buf[0] { - case 1: + case 0: f := func(out, in []byte) { Simple(out, h, in) } return f, nil - case 2: + case 1: _, err = io.ReadFull(r, buf[:8]) if err != nil { return diff --git a/openpgp/s2k/s2k_test.go b/openpgp/s2k/s2k_test.go index 3a094a1..4898828 100644 --- a/openpgp/s2k/s2k_test.go +++ b/openpgp/s2k/s2k_test.go @@ -66,9 +66,9 @@ var parseTests = []struct { spec, in, out string }{ /* Simple with SHA1 */ - {"0102", "hello", "aaf4c61d"}, + {"0002", "hello", "aaf4c61d"}, /* Salted with SHA1 */ - {"02020102030405060708", "hello", "f4f7d67e"}, + {"01020102030405060708", "hello", "f4f7d67e"}, /* Iterated with SHA1 */ {"03020102030405060708f1", "hello", "f2a57b7c"}, }