LEFT | RIGHT |
1 // Copyright 2011 The Go Authors. All rights reserved. | 1 // Copyright 2011 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // Package s2k implements the various OpenPGP string-to-key transforms as | 5 // Package s2k implements the various OpenPGP string-to-key transforms as |
6 // specified in RFC 4800 section 3.7.1. | 6 // specified in RFC 4800 section 3.7.1. |
7 package s2k | 7 package s2k |
8 | 8 |
9 import ( | 9 import ( |
| 10 "code.google.com/p/go.crypto/openpgp/errors" |
10 "crypto" | 11 "crypto" |
11 "crypto/openpgp/errors" | |
12 "hash" | 12 "hash" |
13 "io" | 13 "io" |
14 "strconv" | 14 "strconv" |
15 ) | 15 ) |
16 | 16 |
17 // Simple writes to out the result of computing the Simple S2K function (RFC | 17 // Simple writes to out the result of computing the Simple S2K function (RFC |
18 // 4880, section 3.7.1.1) using the given hash and input passphrase. | 18 // 4880, section 3.7.1.1) using the given hash and input passphrase. |
19 func Simple(out []byte, h hash.Hash, in []byte) { | 19 func Simple(out []byte, h hash.Hash, in []byte) { |
20 Salted(out, h, in, nil) | 20 Salted(out, h, in, nil) |
21 } | 21 } |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 // HashIdToHash returns an OpenPGP hash id which corresponds the given Hash. | 175 // HashIdToHash returns an OpenPGP hash id which corresponds the given Hash. |
176 func HashToHashId(h crypto.Hash) (id byte, ok bool) { | 176 func HashToHashId(h crypto.Hash) (id byte, ok bool) { |
177 for _, m := range hashToHashIdMapping { | 177 for _, m := range hashToHashIdMapping { |
178 if m.hash == h { | 178 if m.hash == h { |
179 return m.id, true | 179 return m.id, true |
180 } | 180 } |
181 } | 181 } |
182 return 0, false | 182 return 0, false |
183 } | 183 } |
LEFT | RIGHT |