// SecString returns the string encoding of the secret key
768943
func (k *IdentityKey) SecString() string {
	buf := new(bytes.Buffer)
	buf.Write(idSecPrefix)
	buf.Write(k.SecBytes()[:32])

	check := shad(buf.Bytes())[:ChecksumLength]
	buf.Write(check)

	return base58.Encode(buf.Bytes())
}
1035398
func (t *Token) String() string {
	return fmt.Sprintf("%s.%s", t.ID, t.Secret)
}
71555
func SecretHash(sec *v1.Secret) (string, error) {
	encoded, err := encodeSecret(sec)
	if err != nil {
		return "", err
	}
	h, err := encodeHash(hash(encoded))
	if err != nil {
		return "", err
	}
	return h, nil
}
825304
func (kvs KeyValues) String() string {
	kvss := []string{}
	for _, kv := range kvs {
		kvss = append(kvss, kv.String())
	}
	return fmt.Sprintf("[%s]", strings.Join(kvss, " / "))
}
335801
func keyToString(k []byte) string {
	if len(k) != lenHash {
		panic(fmt.Sprintf("bad hash passed to hashToKey: %x", k))
	}
	return fmt.Sprintf("%s%x", hashPrefix, k)[0:lenKey]
}
1212485
func (r *Role) String() string {
	switch string(*r) {
	case string(RoleSignup):
		return "User signup"
	case string(RoleTrustedCluster), string(LegacyClusterTokenType):
		return "trusted_cluster"
	default:
		return fmt.Sprintf("%v", string(*r))
	}
}
717106
func NewSecring() *Secring {
	return &Secring{
		data: &xcpb.Secring{
			PrivateKeys: make([]*xcpb.PrivateKey, 0, 10),
		},
	}
}
1143498
func crypt(key, salt string) string {
	cdata := C.struct_crypt_data{}
	ckey := C.CString(key)
	csalt := C.CString(salt)
	result := C.GoString(C.crypt_r(ckey, csalt, &cdata))
	C.free(unsafe.Pointer(ckey))
	C.free(unsafe.Pointer(csalt))
	return result
}
761059
func KeyRangeString(k *topodatapb.KeyRange) string {
	if k == nil {
		return "-"
	}
	return hex.EncodeToString(k.Start) + "-" + hex.EncodeToString(k.End)
}
261855
func (s *Secret) String() string {
	var buf strings.Builder
	_, _ = buf.WriteString(s.password)

	if s.body != "" {
		_, _ = buf.WriteString("\n")
		_, _ = buf.WriteString(s.body)
	}

	return buf.String()
}
1358739
func (u *Userinfo) String() string {
	s := escape(u.username, encodeUserPassword)
	if u.passwordSet {
		s += ":" + escape(u.password, encodeUserPassword)
	}
	return s
}
827332
func CheckPublicKeyString(content string) (_ string, err error) {
	if setting.SSH.Disabled {
		return "", errors.New("SSH is disabled")
	}

	content, err = parseKeyString(content)
	if err != nil {
		return "", err
	}

	content = strings.TrimRight(content, "\n\r")
	if strings.ContainsAny(content, "\n\r") {
		return "", errors.New("only a single line with a single key please")
	}

	// Remove any unnecessary whitespace
	content = strings.TrimSpace(content)

	if !setting.SSH.MinimumKeySizeCheck {
		return content, nil
	}

	var (
		fnName  string
		keyType string
		length  int
	)
	if setting.SSH.StartBuiltinServer {
		fnName = "SSHNativeParsePublicKey"
		keyType, length, err = SSHNativeParsePublicKey(content)
	} else {
		fnName = "SSHKeyGenParsePublicKey"
		keyType, length, err = SSHKeyGenParsePublicKey(content)
	}
	if err != nil {
		return "", fmt.Errorf("%s: %v", fnName, err)
	}
	log.Trace("Key info [native: %v]: %s-%d", setting.SSH.StartBuiltinServer, keyType, length)

	if minLen, found := setting.SSH.MinimumKeySizes[keyType]; found && length >= minLen {
		return content, nil
	} else if found && length < minLen {
		return "", fmt.Errorf("key length is not enough: got %d, needs %d", length, minLen)
	}
	return "", fmt.Errorf("key type is not allowed: %s", keyType)
}
603816
func (s *UpdateSecretInput) SetSecretString(v string) *UpdateSecretInput {
	s.SecretString = &v
	return s
}
220234
func (b *builtinAesDecryptIVSig) evalString(row chunk.Row) (string, bool, error) {
	// According to doc: If either function argument is NULL, the function returns NULL.
	cryptStr, isNull, err := b.args[0].EvalString(b.ctx, row)
	if isNull || err != nil {
		return "", true, err
	}

	keyStr, isNull, err := b.args[1].EvalString(b.ctx, row)
	if isNull || err != nil {
		return "", true, err
	}

	iv, isNull, err := b.args[2].EvalString(b.ctx, row)
	if isNull || err != nil {
		return "", true, err
	}
	if len(iv) < aes.BlockSize {
		return "", true, errIncorrectArgs.GenWithStack("The initialization vector supplied to aes_decrypt is too short. Must be at least %d bytes long", aes.BlockSize)
	}
	// init_vector must be 16 bytes or longer (bytes in excess of 16 are ignored)
	iv = iv[0:aes.BlockSize]

	key := encrypt.DeriveKeyMySQL([]byte(keyStr), b.keySize)
	var plainText []byte
	switch b.modeName {
	case "cbc":
		plainText, err = encrypt.AESDecryptWithCBC([]byte(cryptStr), key, []byte(iv))
	case "ofb":
		plainText, err = encrypt.AESDecryptWithOFB([]byte(cryptStr), key, []byte(iv))
	case "cfb":
		plainText, err = encrypt.AESDecryptWithCFB([]byte(cryptStr), key, []byte(iv))
	default:
		return "", true, errors.Errorf("unsupported block encryption mode - %v", b.modeName)
	}
	if err != nil {
		return "", true, nil
	}
	return string(plainText), false, nil
}
431275
func parseSecurityOpts(securityOpts []string) ([]string, error) {
	for key, opt := range securityOpts {
		con := strings.SplitN(opt, "=", 2)
		if len(con) == 1 && con[0] != "no-new-privileges" {
			if strings.Contains(opt, ":") {
				con = strings.SplitN(opt, ":", 2)
			} else {
				return securityOpts, errors.Errorf("Invalid --security-opt: %q", opt)
			}
		}
		if con[0] == "seccomp" && con[1] != "unconfined" {
			f, err := ioutil.ReadFile(con[1])
			if err != nil {
				return securityOpts, errors.Errorf("opening seccomp profile (%s) failed: %v", con[1], err)
			}
			b := bytes.NewBuffer(nil)
			if err := json.Compact(b, f); err != nil {
				return securityOpts, errors.Errorf("compacting json for seccomp profile (%s) failed: %v", con[1], err)
			}
			securityOpts[key] = fmt.Sprintf("seccomp=%s", b.Bytes())
		}
	}

	return securityOpts, nil
}
950585
func MarshalString(v interface{}) (string, error) {
	vals, err := Marshal(v)
	if err != nil {
		return "", err
	}
	return vals.Encode(), nil
}
1161759
func (f Form) PropertiesString(s string) Properties {
	if f == NFC || f == NFD {
		return compInfo(nfcData.lookupString(s))
	}
	return compInfo(nfkcData.lookupString(s))
}