- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 26 for DecodedLen (0.27 sec)
-
src/encoding/hex/hex.go
func (e InvalidByteError) Error() string { return fmt.Sprintf("encoding/hex: invalid byte: %#U", rune(e)) } // DecodedLen returns the length of a decoding of x source bytes. // Specifically, it returns x / 2. func DecodedLen(x int) int { return x / 2 } // Decode decodes src into [DecodedLen](len(src)) bytes, // returning the actual number of bytes written to dst. // // Decode expects that src contains only hexadecimal
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 08 19:30:23 UTC 2024 - 9.5K bytes - Viewed (0) -
src/encoding/base32/base32.go
return &decoder{enc: enc, r: &newlineFilteringReader{r}} } // DecodedLen returns the maximum length in bytes of the decoded data // corresponding to n bytes of base32-encoded data. func (enc *Encoding) DecodedLen(n int) int { return decodedLen(n, enc.padChar) } func decodedLen(n int, padChar rune) int { if padChar == NoPadding { return n/8*5 + n%8*5/8 } return n / 8 * 5
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 14 16:25:54 UTC 2024 - 15.9K bytes - Viewed (0) -
src/encoding/base32/example_test.go
return } fmt.Printf("%q\n", data) // Output: // "some data with \x00 and \ufeff" } func ExampleEncoding_Decode() { str := "JBSWY3DPFQQHO33SNRSCC===" dst := make([]byte, base32.StdEncoding.DecodedLen(len(str))) n, err := base32.StdEncoding.Decode(dst, []byte(str)) if err != nil { fmt.Println("decode error:", err) return } dst = dst[:n] fmt.Printf("%q\n", dst) // Output: // "Hello, world!"
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Mon Sep 27 16:54:36 UTC 2021 - 1.6K bytes - Viewed (0) -
src/encoding/base64/base64.go
return &decoder{enc: enc, r: &newlineFilteringReader{r}} } // DecodedLen returns the maximum length in bytes of the decoded data // corresponding to n bytes of base64-encoded data. func (enc *Encoding) DecodedLen(n int) int { return decodedLen(n, enc.padChar) } func decodedLen(n int, padChar rune) int { if padChar == NoPadding {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Sep 08 19:04:28 UTC 2023 - 17.6K bytes - Viewed (0) -
src/encoding/base32/base32_test.go
tests = append(tests, test{rawStdEncoding, math.MaxInt, 5764607523034234879}) } for _, tt := range tests { if got := tt.enc.DecodedLen(tt.n); int64(got) != tt.want { t.Errorf("DecodedLen(%d): got %d, want %d", tt.n, got, tt.want) } } } func TestWithoutPaddingClose(t *testing.T) { encodings := []*Encoding{ StdEncoding,
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue May 14 16:25:54 UTC 2024 - 26K bytes - Viewed (0) -
docs/debugging/inspect/utils.go
// Try PEM if block, _ := pem.Decode(priv); block != nil { return x509.ParsePKCS1PrivateKey(block.Bytes) } // Try base 64 dst := make([]byte, base64.StdEncoding.DecodedLen(len(priv))) if n, err := base64.StdEncoding.Decode(dst, priv); err == nil { return x509.ParsePKCS1PrivateKey(dst[:n]) } // Try Raw, return error return x509.ParsePKCS1PrivateKey(priv) }
Registered: Sun Jun 16 00:44:34 UTC 2024 - Last Modified: Wed Nov 02 20:36:38 UTC 2022 - 1.4K bytes - Viewed (0) -
src/encoding/base64/base64_test.go
tests = append(tests, test{RawStdEncoding, math.MaxInt, 6917529027641081855}) } for _, tt := range tests { if got := tt.enc.DecodedLen(tt.n); int64(got) != tt.want { t.Errorf("DecodedLen(%d): got %d, want %d", tt.n, got, tt.want) } } } func TestBig(t *testing.T) { n := 3*1000 + 1 raw := make([]byte, n)
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sun Sep 03 18:57:29 UTC 2023 - 15.9K bytes - Viewed (0) -
src/encoding/base64/example_test.go
return } fmt.Printf("%q\n", data) // Output: // "some data with \x00 and \ufeff" } func ExampleEncoding_Decode() { str := "SGVsbG8sIHdvcmxkIQ==" dst := make([]byte, base64.StdEncoding.DecodedLen(len(str))) n, err := base64.StdEncoding.Decode(dst, []byte(str)) if err != nil { fmt.Println("decode error:", err) return } dst = dst[:n] fmt.Printf("%q\n", dst) // Output: // "Hello, world!"
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Oct 19 08:44:22 UTC 2021 - 1.9K bytes - Viewed (0) -
src/encoding/hex/example_test.go
hex.Encode(dst, src) fmt.Printf("%s\n", dst) // Output: // 48656c6c6f20476f7068657221 } func ExampleDecode() { src := []byte("48656c6c6f20476f7068657221") dst := make([]byte, hex.DecodedLen(len(src))) n, err := hex.Decode(dst, src) if err != nil { log.Fatal(err) } fmt.Printf("%s\n", dst[:n]) // Output: // Hello Gopher! } func ExampleDecodeString() {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Sat Sep 10 21:40:16 UTC 2016 - 2.3K bytes - Viewed (0) -
cmd/kubeadm/app/util/pubkeypin/pubkeypin.go
func (s *Set) allowSHA256(hash string) error { // validate that the hash is the right length to be a full SHA-256 hash hashLength := hex.DecodedLen(len(hash)) if hashLength != sha256.Size { return errors.Errorf("expected a %d byte SHA-256 hash, found %d bytes", sha256.Size, hashLength) } // validate that the hash is valid hex
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Thu May 13 11:38:39 UTC 2021 - 3.8K bytes - Viewed (0)