| // Copyright 2011 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| // NewCanonicalTextHash reformats text written to it into the canonical |
| // form and then applies the hash h. See RFC 4880, section 5.2.1. |
| func NewCanonicalTextHash(h hash.Hash) hash.Hash { |
| return &canonicalTextHash{h, 0} |
| type canonicalTextHash struct { |
| var newline = []byte{'\r', '\n'} |
| func (cth *canonicalTextHash) Write(buf []byte) (int, error) { |
| cth.h.Write(buf[start:i]) |
| func (cth *canonicalTextHash) Sum(in []byte) []byte { |
| func (cth *canonicalTextHash) Reset() { |
| func (cth *canonicalTextHash) Size() int { |
| func (cth *canonicalTextHash) BlockSize() int { |