// BitLength returns the bit length for the given public key.
513717
func (pk *PublicKeyV3) BitLength() (bitLength uint16, err error) {
	switch pk.PubKeyAlgo {
	case PubKeyAlgoRSA, PubKeyAlgoRSAEncryptOnly, PubKeyAlgoRSASignOnly:
		bitLength = pk.n.bitLength
	default:
		err = errors.InvalidArgumentError("bad public-key algorithm")
	}
	return
}
1291541
func ContentLength(length int64) PutObjectInput {
	return func(req *s3.PutObjectInput) {
		req.ContentLength = aws.Int64(length)
	}
}
17981
func (s *MemcacheStore) MaxLength(l int) {
	for _, c := range s.Codecs {
		if codec, ok := c.(*securecookie.SecureCookie); ok {
			codec.MaxLength(l)
		}
	}
}
668174
func (q *MoreLikeThisQuery) MinWordLength(minWordLength int) *MoreLikeThisQuery {
	q.minWordLength = &minWordLength
	return q
}
371647
func (o *ElapseParams) validateLength(formats strfmt.Registry) error {

	if err := validate.MinimumInt("length", "path", int64(o.Length), 2, false); err != nil {
		return err
	}

	if err := validate.MaximumInt("length", "path", int64(o.Length), 30, false); err != nil {
		return err
	}

	return nil
}
799266
func PublicKeyFromBytes(bs []byte, curveType CurveType) (PublicKey, error) {
	switch curveType {
	case CurveTypeEd25519:
		if len(bs) != ed25519.PublicKeySize {
			return PublicKey{}, fmt.Errorf("bytes passed have length %v but ed25519 public keys have %v bytes",
				len(bs), ed25519.PublicKeySize)
		}
	case CurveTypeSecp256k1:
		if len(bs) != btcec.PubKeyBytesLenCompressed {
			return PublicKey{}, fmt.Errorf("bytes passed have length %v but secp256k1 public keys have %v bytes",
				len(bs), btcec.PubKeyBytesLenCompressed)
		}
	case CurveTypeUnset:
		if len(bs) > 0 {
			return PublicKey{}, fmt.Errorf("attempting to create an 'unset' PublicKey but passed non-empty key bytes: %X", bs)
		}
		return PublicKey{}, nil
	default:
		return PublicKey{}, ErrInvalidCurve(curveType)
	}

	return PublicKey{PublicKey: bs, CurveType: curveType}, nil
}
720600
func readHexLength(r io.Reader) (int, error) {
	lengthHex := make([]byte, 4)
	n, err := io.ReadFull(r, lengthHex)
	if err != nil {
		return 0, errIncompleteMessage("length", n, 4)
	}

	length, err := strconv.ParseInt(string(lengthHex), 16, 64)
	if err != nil {
		return 0, errors.WrapErrorf(err, errors.NetworkError, "could not parse hex length %v", lengthHex)
	}

	// Clip the length to 255, as per the Google implementation.
	if length > MaxMessageLength {
		length = MaxMessageLength
	}

	return int(length), nil
}
1363842
func (c *Cache) GroupLength(grpID string) int {
	c.RLock()
	defer c.RUnlock()
	return len(c.groups[grpID])
}
1198444
func (r *Response) ContentLength() int64 {
	for _, h := range r.Headers {
		if strings.EqualFold(h.Key, "Content-Length") {
			length, err := strconv.ParseInt(h.Value, 10, 64)
			if err != nil {
				continue
			}
			return int64(length)
		}
	}
	return -1
}
1040808
func asn1BitLength(bitString []byte) int {
	bitLen := len(bitString) * 8

	for i := range bitString {
		b := bitString[len(bitString)-i-1]

		for bit := uint(0); bit < 8; bit++ {
			if (b>>bit)&1 == 1 {
				return bitLen
			}
			bitLen--
		}
	}

	return 0
}
703279
private static int bitLength(final int bits) {
        int correct = bits;
        if (bits != SiHmac.HMAC256
            && bits != SiHmac.HMAC384
            && bits != SiHmac.HMAC512) {
            correct = SiHmac.HMAC256;
        }
        return correct;
    }
563362
func (q *TermQuery) PrefixLength(length int) *TermQuery {
	q.options["prefix_length"] = length
	return q
}
618882
func (c *PCPClient) Length() int {
	var (
		InstanceLength = Instance1Length
		MetricLength   = Metric1Length
	)

	if c.r.version2 {
		InstanceLength = Instance2Length
		MetricLength = Metric2Length
	}

	return HeaderLength +
		(c.tocCount() * TocLength) +
		(c.r.InstanceCount() * InstanceLength) +
		(c.r.InstanceDomainCount() * InstanceDomainLength) +
		(c.r.MetricCount() * MetricLength) +
		(c.r.ValuesCount() * ValueLength) +
		(c.r.StringCount() * StringLength)
}
490829
public static int getKeyLength(final PublicKey publicKey)
	{
		int length = -1;
		if (publicKey == null)
		{
			return length;
		}
		if (publicKey instanceof RSAPublicKey)
		{
			length = ((RSAPublicKey)publicKey).getModulus().bitLength();
		}
		if (publicKey instanceof DSAPublicKey)
		{
			length = ((DSAPublicKey)publicKey).getParams().getP().bitLength();
		}
		if (publicKey instanceof ECPublicKey)
		{
			length = ((ECPublicKey)publicKey).getParams().getCurve().getField().getFieldSize();
		}

		return length;
	}
385718
func (f *NewTokenFrame) Length(protocol.VersionNumber) protocol.ByteCount {
	return 1 + utils.VarIntLen(uint64(len(f.Token))) + protocol.ByteCount(len(f.Token))
}
185294
func Length(x uint64) int {
	if x < 10 {
		return 1
	}
	// From https://graphics.stanford.edu/~seander/bithacks.html#IntegerLog10
	r := int((bits.Len64(x) * 1233) >> 12)
	if p, _ := Pow10(uint64(r)); x < p {
		return r
	}
	return r + 1
}
1296128
func (f *StopSendingFrame) Length(_ protocol.VersionNumber) protocol.ByteCount {
	return 1 + utils.VarIntLen(uint64(f.StreamID)) + 2
}