Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 13 for DecodedLen (0.14 sec)

  1. 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)
  2. 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)
  3. 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)
  4. src/encoding/hex/hex_test.go

    	// Encode always uses lowercase.
    	decTests := append(encDecTests, encDecTest{"F8F9FAFBFCFDFEFF", []byte{0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff}})
    	for i, test := range decTests {
    		dst := make([]byte, DecodedLen(len(test.enc)))
    		n, err := Decode(dst, []byte(test.enc))
    		if err != nil {
    			t.Errorf("#%d: bad return value: got:%d want:%d", i, n, len(dst))
    		} else if !bytes.Equal(dst, test.dec) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 19:30:23 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  5. src/encoding/pem/pem.go

    		// The line must end with only whitespace.
    		if s, _ := getLine(restOfEndLine); len(s) != 0 {
    			continue
    		}
    
    		base64Data := removeSpacesAndTabs(rest[:endIndex])
    		p.Bytes = make([]byte, base64.StdEncoding.DecodedLen(len(base64Data)))
    		n, err := base64.StdEncoding.Decode(p.Bytes, base64Data)
    		if err != nil {
    			continue
    		}
    		p.Bytes = p.Bytes[:n]
    
    		// the -1 is because we might have only matched pemEnd without the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 7.6K bytes
    - Viewed (0)
  6. internal/auth/credentials.go

    	}
    	if length <= 0 {
    		length = secretKeyMaxLen
    	}
    	if length < secretKeyMinLen {
    		return "", errors.New("auth: secret key length is too short")
    	}
    
    	key := make([]byte, base64.RawStdEncoding.DecodedLen(length))
    	if _, err := io.ReadFull(random, key); err != nil {
    		return "", err
    	}
    
    	s := base64.RawStdEncoding.EncodeToString(key)
    	return strings.ReplaceAll(s, "/", "+"), nil
    }
    
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 28 17:14:16 UTC 2024
    - 12K bytes
    - Viewed (0)
  7. pkg/volume/util/atomic_writer_test.go

    AAAAAAAAAAEAAAAFAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAAAAfQAAAAAAAAB9AAAAAAAAAAAA
    IAAAAAAAsDyZDwU=`
    
    	mysteryBinaryBytes := make([]byte, base64.StdEncoding.DecodedLen(len(encodedMysteryBinary)))
    	numBytes, err := base64.StdEncoding.Decode(mysteryBinaryBytes, []byte(encodedMysteryBinary))
    	if err != nil {
    		t.Fatalf("Unexpected error decoding binary payload: %v", err)
    	}
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Sat May 11 09:02:45 UTC 2024
    - 30.5K bytes
    - Viewed (0)
  8. src/encoding/json/decode.go

    			if v.Type().Elem().Kind() != reflect.Uint8 {
    				d.saveError(&UnmarshalTypeError{Value: "string", Type: v.Type(), Offset: int64(d.readIndex())})
    				break
    			}
    			b := make([]byte, base64.StdEncoding.DecodedLen(len(s)))
    			n, err := base64.StdEncoding.Decode(b, s)
    			if err != nil {
    				d.saveError(err)
    				break
    			}
    			v.SetBytes(b[:n])
    		case reflect.String:
    			t := string(s)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:18:55 UTC 2024
    - 35.3K bytes
    - Viewed (0)
  9. src/cmd/link/internal/ld/elf.go

    		return
    	}
    
    	if !strings.HasPrefix(val, "0x") {
    		Exitf("-B argument must start with 0x: %s", val)
    	}
    
    	ov := val
    	val = val[2:]
    
    	const maxLen = 32
    	if hex.DecodedLen(len(val)) > maxLen {
    		Exitf("-B option too long (max %d digits): %s", maxLen, ov)
    	}
    
    	b, err := hex.DecodeString(val)
    	if err != nil {
    		if err == hex.ErrLength {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Apr 22 13:29:54 UTC 2024
    - 63.6K bytes
    - Viewed (0)
  10. src/cmd/vendor/golang.org/x/sys/windows/zsyscall_windows.go

    	r1, _, e1 := syscall.Syscall9(procCryptDecodeObject.Addr(), 7, uintptr(encodingType), uintptr(unsafe.Pointer(structType)), uintptr(unsafe.Pointer(encodedBytes)), uintptr(lenEncodedBytes), uintptr(flags), uintptr(decoded), uintptr(unsafe.Pointer(decodedLen)), 0, 0)
    	if r1 == 0 {
    		err = errnoErr(e1)
    	}
    	return
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Jun 04 16:19:04 UTC 2024
    - 195.8K bytes
    - Viewed (0)
Back to top