Search Options

Results per page
Sort
Preferred Languages
Advance

Results 41 - 50 of 65 for GetBytes (0.21 sec)

  1. internal/config/crypto_test.go

    	}
    
    	benchmarkEncrypt := func(size int, b *testing.B) {
    		var (
    			data      = make([]byte, size)
    			plaintext = bytes.NewReader(data)
    			context   = kms.Context{"key": "value"}
    		)
    		b.SetBytes(int64(size))
    		for i := 0; i < b.N; i++ {
    			ciphertext, err := Encrypt(KMS, plaintext, context)
    			if err != nil {
    				b.Fatal(err)
    			}
    			if _, err = io.Copy(io.Discard, ciphertext); err != nil {
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Tue May 07 23:55:37 UTC 2024
    - 3.2K bytes
    - Viewed (0)
  2. src/crypto/internal/bigmod/nat.go

    			}
    			bytes[i] = byte(limb)
    			limb >>= 8
    		}
    	}
    	return bytes
    }
    
    // SetBytes assigns x = b, where b is a slice of big-endian bytes.
    // SetBytes returns an error if b >= m.
    //
    // The output will be resized to the size of m and overwritten.
    func (x *Nat) SetBytes(b []byte, m *Modulus) (*Nat, error) {
    	if err := x.setBytes(b, m); err != nil {
    		return nil, err
    	}
    	if x.cmpGeq(m.nat) == yes {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 24K bytes
    - Viewed (0)
  3. src/index/suffixarray/suffixarray_test.go

    	b.StopTimer()
    	data := benchdata
    	if random {
    		data = benchrand
    		if data[0] == 0 {
    			for i := range data {
    				data[i] = byte(rand.Intn(256))
    			}
    		}
    	}
    	b.StartTimer()
    	b.SetBytes(int64(len(data)))
    	for i := 0; i < b.N; i++ {
    		New(data)
    	}
    }
    
    func makeText(name string) ([]byte, error) {
    	var data []byte
    	switch name {
    	case "opticks":
    		var err error
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 14.1K bytes
    - Viewed (0)
  4. src/bytes/buffer_test.go

    	}
    }
    
    func BenchmarkWriteByte(b *testing.B) {
    	const n = 4 << 10
    	b.SetBytes(n)
    	buf := NewBuffer(make([]byte, n))
    	for i := 0; i < b.N; i++ {
    		buf.Reset()
    		for i := 0; i < n; i++ {
    			buf.WriteByte('x')
    		}
    	}
    }
    
    func BenchmarkWriteRune(b *testing.B) {
    	const n = 4 << 10
    	const r = '☺'
    	b.SetBytes(int64(n * utf8.RuneLen(r)))
    	buf := NewBuffer(make([]byte, n*utf8.UTFMax))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri Apr 26 13:31:36 UTC 2024
    - 18.6K bytes
    - Viewed (0)
  5. src/crypto/rsa/rsa.go

    		if err != nil {
    			return nil, ErrDecryption
    		}
    		c, err = bigmod.NewNat().SetBytes(ciphertext, N)
    		if err != nil {
    			return nil, ErrDecryption
    		}
    		m = bigmod.NewNat().Exp(c, priv.D.Bytes(), N)
    	} else {
    		N = priv.Precomputed.n
    		P, Q := priv.Precomputed.p, priv.Precomputed.q
    		Qinv, err := bigmod.NewNat().SetBytes(priv.Precomputed.Qinv.Bytes(), P)
    		if err != nil {
    			return nil, ErrDecryption
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 23.4K bytes
    - Viewed (0)
  6. src/math/big/floatmarsh.go

    	if z.form == finite {
    		if len(buf) < 10 {
    			return errors.New("Float.GobDecode: buffer too small for finite form float")
    		}
    		z.exp = int32(byteorder.BeUint32(buf[6:]))
    		z.mant = z.mant.setBytes(buf[10:])
    	}
    
    	if oldPrec != 0 {
    		z.mode = oldMode
    		z.SetPrec(uint(oldPrec))
    	}
    
    	if msg := z.validate0(); msg != "" {
    		return errors.New("Float.GobDecode: " + msg)
    	}
    
    	return nil
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:31:58 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  7. src/encoding/base32/base32_test.go

    func BenchmarkEncode(b *testing.B) {
    	data := make([]byte, 8192)
    	buf := make([]byte, StdEncoding.EncodedLen(len(data)))
    	b.SetBytes(int64(len(data)))
    	for i := 0; i < b.N; i++ {
    		StdEncoding.Encode(buf, data)
    	}
    }
    
    func BenchmarkEncodeToString(b *testing.B) {
    	data := make([]byte, 8192)
    	b.SetBytes(int64(len(data)))
    	for i := 0; i < b.N; i++ {
    		StdEncoding.EncodeToString(data)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue May 14 16:25:54 UTC 2024
    - 26K bytes
    - Viewed (0)
  8. src/bytes/bytes_test.go

    	for _, n := range sizes {
    		if isRaceBuilder && n > 4<<10 {
    			continue
    		}
    		b.Run(valName(n), func(b *testing.B) {
    			if len(bmbuf) < n {
    				bmbuf = make([]byte, n)
    			}
    			b.SetBytes(int64(n))
    			f(b, n)
    		})
    	}
    }
    
    var indexSizes = []int{10, 32, 4 << 10, 4 << 20, 64 << 20}
    
    var isRaceBuilder = strings.HasSuffix(testenv.Builder(), "-race")
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Fri May 03 12:58:37 UTC 2024
    - 56.5K bytes
    - Viewed (0)
  9. src/crypto/internal/nistec/p256_asm.go

    const p256CompressedLength = 1 + p256ElementLength
    
    // SetBytes sets p to the compressed, uncompressed, or infinity value encoded in
    // b, as specified in SEC 1, Version 2.0, Section 2.3.4. If the point is not on
    // the curve, it returns nil and an error, and the receiver is unchanged.
    // Otherwise, it returns p.
    func (p *P256Point) SetBytes(b []byte) (*P256Point, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 21.4K bytes
    - Viewed (0)
  10. src/crypto/ed25519/ed25519.go

    		panic("ed25519: bad public key length: " + strconv.Itoa(l))
    	}
    
    	if len(sig) != SignatureSize || sig[63]&224 != 0 {
    		return false
    	}
    
    	A, err := (&edwards25519.Point{}).SetBytes(publicKey)
    	if err != nil {
    		return false
    	}
    
    	kh := sha512.New()
    	if domPrefix != domPrefixPure {
    		kh.Write([]byte(domPrefix))
    		kh.Write([]byte{byte(len(context))})
    		kh.Write([]byte(context))
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 11.7K bytes
    - Viewed (0)
Back to top