// OpenBase32String opens a base32 encoded message.
179435
func OpenBase32String(ciphertext32 string, secretKeyBytes []byte) ([]byte, error) {
	ciphertext, err := base32.StdEncoding.DecodeString(ciphertext32)
	if err != nil {
		return ciphertext, err
	}
	return OpenBox(ciphertext, secretKeyBytes)
}
578784
func (c *Client) OpenBinaryStream(prefix, path logdog_types.StreamName, flags ...*streamproto.Flags) (*Stream, error) {
	return c.open(logpb.StreamType_BINARY, prefix, path, flags...)
}
274106
func toString(in interface{}) (string, error) {
	inValue := reflect.ValueOf(in)

	switch inValue.Kind() {
	case reflect.String:
		return inValue.String(), nil
	case reflect.Bool:
		b := inValue.Bool()
		if b {
			return "true", nil
		}
		return "false", nil
	case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
		return fmt.Sprintf("%v", inValue.Int()), nil
	case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
		return fmt.Sprintf("%v", inValue.Uint()), nil
	case reflect.Float32:
		return strconv.FormatFloat(inValue.Float(), byte('f'), -1, 32), nil
	case reflect.Float64:
		return strconv.FormatFloat(inValue.Float(), byte('f'), -1, 64), nil
	}
	return "", fmt.Errorf("No known conversion from " + inValue.Type().String() + " to string")
}
764506
func (cd *ConnectionDetails) OptionsString(s string) string {
	if cd.RawOptions != "" {
		return cd.RawOptions
	}
	if cd.Options != nil {
		for k, v := range cd.Options {
			s = fmt.Sprintf("%s&%s=%s", s, k, v)
		}
	}
	return strings.TrimLeft(s, "&")
}
98267
func (ctx *ServiceContext) OpenDatabase(name string, cache int, handles int, namespace string) (ethdb.Database, error) {
	if ctx.config.DataDir == "" {
		return rawdb.NewMemoryDatabase(), nil
	}
	db, err := rawdb.NewLevelDBDatabase(ctx.config.ResolvePath(name), cache, handles, namespace)
	if err != nil {
		return nil, err
	}
	return db, nil
}
196153
func (info *BaseServiceInfo) String() string {
	return fmt.Sprintf("%s:%d/%s", info.ClusterIP, info.Port, info.Protocol)
}
657343
func base32ToUint64(data []byte) (uint64, error) {
	// Maximum that fits in uint64 is ceil(64 / 5) = 12 groups.
	if len(data) > 13 {
		return 0, fmt.Errorf("cannot parse data of length %d as uint64",
			len(data))
	}

	val := uint64(0)
	for i := 0; i < len(data); i++ {
		val = val<<5 | uint64(data[i])
	}
	return val, nil
}
1279591
func getBase() (base int64) {
	base = bcm2835Base
	ranges, err := os.Open("/proc/device-tree/soc/ranges")
	defer ranges.Close()
	if err != nil {
		return
	}
	b := make([]byte, 4)
	n, err := ranges.ReadAt(b, 4)
	if n != 4 || err != nil {
		return
	}
	buf := bytes.NewReader(b)
	var out uint32
	err = binary.Read(buf, binary.BigEndian, &out)
	if err != nil {
		return
	}
	return int64(out)
}
767072
func StringToInt32(from string) (int32, error) {
	val, err := strconv.ParseInt(from, DefeultNumericBase, 32)
	return int32(val), err
}
776172
func (s StringStringMap) GetUint32(key string) (uint32, error) {
	return s.getUint32(key, false)
}
528366
func Basename(s string) string {
	n := strings.LastIndexByte(s, '.')
	if n > 0 {
		return s[:n]
	}
	return s
}
516378
func DecodeBase64(s string) (int, error) {
	n := 0
	for _, c := range s {
		n *= 36
		i := strings.IndexRune(base64Chars, c)
		if i == -1 {
			return 0, errInvalidBase64
		}
		n += i
	}
	return n, nil
}
1300533
func ParseUint32(valueString string) (uint32, error) {
	if valueString == "" {
		return 0, nil
	}
	valueString = strings.Replace(valueString, ",", "", -1)
	value, err := strconv.ParseUint(valueString, 10, 32)
	if err != nil {
		return 0, err
	}
	return uint32(value), nil
}
9666
func (f ID) Base32() string {

	if f < 32 {
		return string(encodeBase32Map[f])
	}

	b := make([]byte, 0, 12)
	for f >= 32 {
		b = append(b, encodeBase32Map[f%32])
		f /= 32
	}
	b = append(b, encodeBase32Map[f])

	for x, y := 0, len(b)-1; x < y; x, y = x+1, y-1 {
		b[x], b[y] = b[y], b[x]
	}

	return string(b)
}
495996
func (nb NullBase) String() string {
	if nb.IsNil() {
		return "null"
	}
	return fmt.Sprint(nb.value)
}
754327
func (p *TCompactProtocol) ReadString() (value string, err error) {
	v, e := p.ReadBinary()
	return string(v), NewTProtocolException(e)
}
1364293
func Uint32ToString(from uint32) (string, error) {
	return strconv.FormatUint(uint64(from), DefeultNumericBase), nil
}