func S2KparamsToItertions(s2kparams string) (int64, error) {
	var i uint32
	if len(s2kparams) != 8 {
		return int64(s2kParamsZero), errors.New("invalid s2kparams length")
	}
	b, err := hex.DecodeString(s2kparams)
	if err != nil {
		return int64(s2kParamsZero), errors.New("invalid s2kparams, cannot decode string to bytes")
	}
	i = binary.BigEndian.Uint32(b)
	if err != nil {
		return int64(s2kParamsZero), errors.New("invalid s2kparams, cannot convert to big endian int32")
	}
	return int64(i), nil
}
S2KparamsToItertions converts the string representation of iterations to an integer
package rfc3962
import (
	"encoding/binary"
	"encoding/hex"
	"errors"
	"github.com/jcmturner/gofork/x/crypto/pbkdf2"
	"gopkg.in/jcmturner/gokrb5.v7/crypto/etype"
)
const (
	s2kParamsZero = 4294967296
)
func StringToKey(secret, salt, s2kparams string, e etype.EType) ([]byte, error) {
	i, err := S2KparamsToItertions(s2kparams)
	if err != nil {
		return nil, err
	}
	return StringToKeyIter(secret, salt, i, e)
}
func StringToPBKDF2(secret, salt string, iterations int64, e etype.EType) []byte {
	return pbkdf2.Key64([]byte(secret), []byte(salt), iterations, int64(e.GetKeyByteSize()), e.GetHashFunc())
}
func StringToKeyIter(secret, salt string, iterations int64, e etype.EType) ([]byte, error) {
	tkey := e.RandomToKey(StringToPBKDF2(secret, salt, iterations, e))
	return e.DeriveKey(tkey, []byte("kerberos"))
}