Documentation ¶
Index ¶
- func B(n int) []byte
- func D(min, max time.Duration) time.Duration
- func Digits(n int) string
- func Intn(max int) int
- func Letters(n int) string
- func Meet(num, total int) bool
- func MeetProb(prob float32) bool
- func N(min, max int) int
- func PadLeftZeros(str string, length int) string
- func Perm(n int) []int
- func S(n int, symbols ...bool) string
- func Str(s string, n int) string
- func Symbols(n int) string
- type Secret
- func (Secret) Decode(data []byte) ([]byte, error)
- func (Secret) DecryptAuthorization(token, secretKey string, iv []byte) (DecryptStr, uuid string, err error)
- func (Secret) DecryptCBC(cipherText, key, iv []byte, ivs ...[]byte) ([]byte, error)
- func (Secret) Encode(src []byte) []byte
- func (Secret) Encrypt(data any) (encrypt string, err error)
- func (Secret) EncryptBytes(data []byte) (encrypt string, err error)
- func (Secret) EncryptCBC(plainText, key, iv []byte, ivs ...[]byte) ([]byte, error)
- func (Secret) EncryptToken(key, secretKey string, iv []byte, randStr ...string) (encryptStr, uuid string, err error)
- func (Secret) MustEncrypt(data any) string
- func (Secret) PKCS7Padding(src []byte, blockSize int) []byte
- func (Secret) PKCS7UnPadding(src []byte, blockSize int) ([]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func N ¶
N returns a random int between min and max: [min, max]. The `min` and `max` also support negative numbers.
func Perm ¶
Perm returns, as a slice of n int numbers, a pseudo-random permutation of the integers [0,n). TODO performance improving for large slice producing.
func S ¶
S returns a random str which contains digits and letters, and its length is `n`. The optional parameter `symbols` specifies whether the result could contain symbols, which is false in default.
Types ¶
type Secret ¶
type Secret struct{}
func (Secret) DecryptAuthorization ¶
func (Secret) DecryptCBC ¶
func (Secret) EncryptCBC ¶
func (Secret) EncryptToken ¶
func (Secret) MustEncrypt ¶
Click to show internal directories.
Click to hide internal directories.