mirror of
https://git.uploadfilter24.eu/lerentis/terraform-provider-gitea.git
synced 2024-11-05 10:28:12 +00:00
910ccdb092
Bumps [github.com/hashicorp/terraform-plugin-sdk/v2](https://github.com/hashicorp/terraform-plugin-sdk) from 2.26.1 to 2.27.0. - [Release notes](https://github.com/hashicorp/terraform-plugin-sdk/releases) - [Changelog](https://github.com/hashicorp/terraform-plugin-sdk/blob/main/CHANGELOG.md) - [Commits](https://github.com/hashicorp/terraform-plugin-sdk/compare/v2.26.1...v2.27.0) --- updated-dependencies: - dependency-name: github.com/hashicorp/terraform-plugin-sdk/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
65 lines
1.2 KiB
Go
65 lines
1.2 KiB
Go
// 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.
|
|
|
|
package openpgp
|
|
|
|
import (
|
|
"hash"
|
|
"io"
|
|
)
|
|
|
|
// 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 {
|
|
h hash.Hash
|
|
s int
|
|
}
|
|
|
|
var newline = []byte{'\r', '\n'}
|
|
|
|
func writeCanonical(cw io.Writer, buf []byte, s *int) (int, error) {
|
|
start := 0
|
|
for i, c := range buf {
|
|
switch *s {
|
|
case 0:
|
|
if c == '\r' {
|
|
*s = 1
|
|
} else if c == '\n' {
|
|
cw.Write(buf[start:i])
|
|
cw.Write(newline)
|
|
start = i + 1
|
|
}
|
|
case 1:
|
|
*s = 0
|
|
}
|
|
}
|
|
|
|
cw.Write(buf[start:])
|
|
return len(buf), nil
|
|
}
|
|
|
|
func (cth *canonicalTextHash) Write(buf []byte) (int, error) {
|
|
return writeCanonical(cth.h, buf, &cth.s)
|
|
}
|
|
|
|
func (cth *canonicalTextHash) Sum(in []byte) []byte {
|
|
return cth.h.Sum(in)
|
|
}
|
|
|
|
func (cth *canonicalTextHash) Reset() {
|
|
cth.h.Reset()
|
|
cth.s = 0
|
|
}
|
|
|
|
func (cth *canonicalTextHash) Size() int {
|
|
return cth.h.Size()
|
|
}
|
|
|
|
func (cth *canonicalTextHash) BlockSize() int {
|
|
return cth.h.BlockSize()
|
|
}
|