Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 65 for GetBytes (0.45 sec)

  1. src/encoding/binary/binary_test.go

    }
    
    func BenchmarkPutUint16(b *testing.B) {
    	b.SetBytes(2)
    	for i := 0; i < b.N; i++ {
    		BigEndian.PutUint16(putbuf[:2], uint16(i))
    	}
    }
    
    func BenchmarkAppendUint16(b *testing.B) {
    	b.SetBytes(2)
    	for i := 0; i < b.N; i++ {
    		putbuf = BigEndian.AppendUint16(putbuf[:0], uint16(i))
    	}
    }
    
    func BenchmarkPutUint32(b *testing.B) {
    	b.SetBytes(4)
    	for i := 0; i < b.N; i++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 20 19:16:18 UTC 2024
    - 25.4K bytes
    - Viewed (0)
  2. src/crypto/ecdsa/ecdsa.go

    	Q, err := c.pointFromAffine(pub.X, pub.Y)
    	if err != nil {
    		return false
    	}
    
    	// SEC 1, Version 2.0, Section 4.1.4
    
    	r, err := bigmod.NewNat().SetBytes(rBytes, c.N)
    	if err != nil || r.IsZero() == 1 {
    		return false
    	}
    	s, err := bigmod.NewNat().SetBytes(sBytes, c.N)
    	if err != nil || s.IsZero() == 1 {
    		return false
    	}
    
    	e := bigmod.NewNat()
    	hashToNat(c, e, hash)
    
    	// w = s⁻¹
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 20.4K bytes
    - Viewed (0)
  3. src/crypto/ecdsa/ecdsa_legacy.go

    }
    
    func verifyLegacy(pub *PublicKey, hash []byte, sig []byte) bool {
    	rBytes, sBytes, err := parseSignature(sig)
    	if err != nil {
    		return false
    	}
    	r, s := new(big.Int).SetBytes(rBytes), new(big.Int).SetBytes(sBytes)
    
    	c := pub.Curve
    	N := c.Params().N
    
    	if r.Sign() <= 0 || s.Sign() <= 0 {
    		return false
    	}
    	if r.Cmp(N) >= 0 || s.Cmp(N) >= 0 {
    		return false
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 00:11:18 UTC 2024
    - 4.8K bytes
    - Viewed (0)
  4. src/crypto/ecdh/nist.go

    	}
    	if boring.Enabled {
    		bk, err := boring.NewPublicKeyECDH(c.name, k.publicKey)
    		if err != nil {
    			return nil, err
    		}
    		k.boring = bk
    	} else {
    		// SetBytes also checks that the point is on the curve.
    		if _, err := c.newPoint().SetBytes(key); err != nil {
    			return nil, err
    		}
    	}
    	return k, nil
    }
    
    func (c *nistCurve[Point]) ecdh(local *PrivateKey, remote *PublicKey) ([]byte, error) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 8.1K bytes
    - Viewed (0)
  5. src/encoding/hex/hex_test.go

    		b.Run(fmt.Sprintf("%v", size), func(b *testing.B) {
    			b.SetBytes(int64(size))
    			for i := 0; i < b.N; i++ {
    				Decode(sink, src)
    			}
    		})
    	}
    }
    
    func BenchmarkDecodeString(b *testing.B) {
    	for _, size := range []int{256, 1024, 4096, 16384} {
    		src := strings.Repeat("2b744faa", size/8)
    		b.Run(fmt.Sprintf("%v", size), func(b *testing.B) {
    			b.SetBytes(int64(size))
    			for i := 0; i < b.N; i++ {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed May 08 19:30:23 UTC 2024
    - 7.9K bytes
    - Viewed (0)
  6. src/math/big/ratmarsh.go

    		return errors.New("Rat.GobDecode: invalid length")
    	}
    	i := j + int(ln)
    	if len(buf) < i {
    		return errors.New("Rat.GobDecode: buffer too small")
    	}
    	z.a.neg = b&1 != 0
    	z.a.abs = z.a.abs.setBytes(buf[j:i])
    	z.b.abs = z.b.abs.setBytes(buf[i:])
    	return nil
    }
    
    // MarshalText implements the [encoding.TextMarshaler] interface.
    func (x *Rat) MarshalText() (text []byte, err error) {
    	if x.IsInt() {
    		return x.a.MarshalText()
    	}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 21:31:58 UTC 2024
    - 2.2K bytes
    - Viewed (0)
  7. src/math/big/int_test.go

    	i := 0
    	for i < len(z) && z[i] == 0 {
    		i++
    	}
    
    	return z[i:]
    }
    
    func checkMul(a, b []byte) bool {
    	var x, y, z1 Int
    	x.SetBytes(a)
    	y.SetBytes(b)
    	z1.Mul(&x, &y)
    
    	var z2 Int
    	z2.SetBytes(mulBytes(a, b))
    
    	return z1.Cmp(&z2) == 0
    }
    
    func TestMul(t *testing.T) {
    	if err := quick.Check(checkMul, nil); err != nil {
    		t.Error(err)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 18:42:28 UTC 2024
    - 58.5K bytes
    - Viewed (0)
  8. internal/grid/benchmark_test.go

    				defer timeout(60 * time.Second)()
    				ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
    				defer cancel()
    				b.ReportAllocs()
    				b.SetBytes(int64(len(payload) * 2))
    				b.ResetTimer()
    				t := time.Now()
    				var ops int64
    				var lat int64
    				b.SetParallelism(par)
    				b.RunParallel(func(pb *testing.PB) {
    Registered: Sun Jun 16 00:44:34 UTC 2024
    - Last Modified: Fri Jun 07 15:51:52 UTC 2024
    - 15.7K bytes
    - Viewed (0)
  9. src/crypto/internal/edwards25519/field/fe.go

    }
    
    // Set sets v = a, and returns v.
    func (v *Element) Set(a *Element) *Element {
    	*v = *a
    	return v
    }
    
    // SetBytes sets v to x, where x is a 32-byte little-endian encoding. If x is
    // not of the right length, SetBytes returns nil and an error, and the
    // receiver is unchanged.
    //
    // Consistent with RFC 7748, the most significant bit (the high bit of the
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon May 13 18:57:38 UTC 2024
    - 11.8K bytes
    - Viewed (0)
  10. src/image/gif/writer_test.go

    	paletted := image.NewPaletted(image.Rect(0, 0, 640, 480), palette.Plan9)
    	rnd := rand.New(rand.NewSource(123))
    	for i := range paletted.Pix {
    		paletted.Pix[i] = uint8(rnd.Intn(256))
    	}
    
    	b.SetBytes(640 * 480 * 1)
    	b.ReportAllocs()
    	b.ResetTimer()
    	for i := 0; i < b.N; i++ {
    		Encode(io.Discard, paletted, nil)
    	}
    }
    
    func BenchmarkEncodeRandomRGBA(b *testing.B) {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 03 14:56:25 UTC 2024
    - 19K bytes
    - Viewed (0)
Back to top