Source File
canonical_text.go
Belonging Package
golang.org/x/crypto/openpgp
package openpgp
import
func ( hash.Hash) hash.Hash {
return &canonicalTextHash{, 0}
}
type canonicalTextHash struct {
h hash.Hash
s int
}
var newline = []byte{'\r', '\n'}
func ( *canonicalTextHash) ( []byte) (int, error) {
:= 0
for , := range {
switch .s {
case 0:
if == '\r' {
.s = 1
} else if == '\n' {
.h.Write([:])
.h.Write(newline)
= + 1
}
case 1:
.s = 0
}
}
.h.Write([:])
return len(), nil
}
func ( *canonicalTextHash) ( []byte) []byte {
return .h.Sum()
}
func ( *canonicalTextHash) () {
.h.Reset()
.s = 0
}
func ( *canonicalTextHash) () int {
return .h.Size()
}
func ( *canonicalTextHash) () int {
return .h.BlockSize()
![]() |
The pages are generated with Golds v0.3.2-preview. (GOOS=darwin GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |