// shortID produces a "unique" 6 bytes long string.
// Do not use as a reliable way to get unique IDs, instead use for things like logging.
420968
func shortID() (string, error) {
	b := make([]byte, 6)
	if _, err := io.ReadFull(rand.Reader, b); err != nil {
		return "", err
	}
	return base64.StdEncoding.EncodeToString(b), nil
}
383474
func (c Case) ShortString(length int) string {
	return fmt.Sprintf("%s%d [%s, %s]: %s(%s) = %s %s",
		c.Prefix, c.Prec, c.Trap, c.Mode, c.Op,
		join(c.Inputs, ", ", length), trunc(c.Output, length), c.Excep)
}
1324064
func (sid *Shortid) String() string {
	return fmt.Sprintf("Shortid(worker=%v, epoch=%v, abc=%v)", sid.worker, sid.epoch, sid.abc)
}
1012604
func (self *Temp) Id() string {
	return fmt.Sprintf("%02x:%02x", self.id>>8, self.id&0xff)
}
1016874
func padID(id string) string {
	expectedLen := 0
	if len(id) < 16 {
		expectedLen = 16
	} else if len(id) > 16 && len(id) < 32 {
		expectedLen = 32
	} else {
		return id
	}

	return pads[expectedLen-len(id)] + id
}
214854
func genID(length int) string {
	r := make([]byte, length)
	io.ReadFull(rand.Reader, r)
	return base64.URLEncoding.EncodeToString(r)
}
189479
func FakeID(b byte) ID {
	dh := kbfshash.RawDefaultHash{b}
	h, err := kbfshash.HashFromRaw(kbfshash.DefaultHashType, dh[:])
	if err != nil {
		panic(err)
	}
	return ID{h}
}
1060163
func (mpi *MempoolInfo) ID() uint64 {
	mpi.RLock()
	defer mpi.RUnlock()
	return mpi.Ident
}
707544
func (o *ociInstance) Id() instance.Id {
	return instance.Id(*o.raw.Id)
}
570659
func ID() (id [64]byte, err error) {
	var buf []byte

	// Time part
	now, err := time.Now().MarshalBinary()
	if err != nil {
		return
	}
	buf = append(buf, now[:15]...)

	// Local ID part
	buf = append(buf, localID[:]...)

	// Random value
	r, err := GetBytes(40)
	if err != nil {
		return
	}
	buf = append(buf, r...)

	_, err = io.ReadFull(bytes.NewBuffer(buf), id[:])
	return
}
233009
func (k *TUFKey) ID() string {
	if k.id == "" {
		pubK := TUFKey{
			Type: k.Algorithm(),
			Value: KeyPair{
				Public:  k.Public(),
				Private: nil,
			},
		}
		data, err := json.MarshalCanonical(&pubK)
		if err != nil {
			logrus.Error("Error generating key ID:", err)
		}
		digest := sha256.Sum256(data)
		k.id = hex.EncodeToString(digest[:])
	}
	return k.id
}
44371
func StringFromIID(iid *GUID) (str string, err error) {
	var p *uint16
	hr, _, _ := procStringFromIID.Call(uintptr(unsafe.Pointer(iid)), uintptr(unsafe.Pointer(&p)))
	if hr != 0 {
		err = NewError(hr)
	}
	str = LpOleStrToString(p)
	return
}
274475
func (cpcode *CpCode) ID() int {
	id, err := strconv.Atoi(strings.TrimPrefix(cpcode.CpcodeID, "cpc_"))
	if err != nil {
		return 0
	}

	return id
}
503775
func generateID(appendWith string) (string, error) {
	random, err := rand.Int(rand.Reader, maxInt64)
	if err != nil {
		return "", nil
	}
	hostname, err := os.Hostname()
	if err != nil {
		hostname = "localhost"
	}
	pid := os.Getpid()
	nanoTime := time.Now().UTC().UnixNano()
	if len(appendWith) == 0 {
		return fmt.Sprintf("%d.%d.%d@%s", nanoTime, pid, random, hostname), nil
	}
	return fmt.Sprintf("%d.%d.%d.%s@%s", nanoTime, pid, random, appendWith, hostname), nil
}
471097
func (self *TempHumid) Id() string {
	return fmt.Sprintf("%02x:%02x", self.id>>8, self.id&0xff)
}
620927
func (self *LightingX10) Id() string {
	return fmt.Sprintf("%s%02x", lightingX10HouseCodes[self.HouseCode], self.UnitCode)
}
81089
func RandomID(prefix string) (string, error) {
	buf, err := RandBytes(32)
	if err != nil {
		return "", err
	}
	str := base32.StdEncoding.EncodeToString(buf)
	str = strings.Replace(str, "=", "", -1)
	str = prefix + str
	return str, nil
}