Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1474)

Delta Between Two Patch Sets: openpgp/s2k/s2k.go

Issue 5564059: code review 5564059: go.crypto: initial code (Closed)
Left Patch Set: diff -r b50a7fb49394 https://code.google.com/p/go.crypto Created 12 years, 2 months ago
Right Patch Set: diff -r b50a7fb49394 https://code.google.com/p/go.crypto Created 12 years, 2 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « openpgp/read_test.go ('k') | openpgp/s2k/s2k_test.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
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
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 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b