Documentation ¶
Overview ¶
Package sencryption provides String related operations
Index ¶
- func AesDecrypt(cipherText []byte, key string, iv ...string) (plainText []byte, err error)
- func AesDecryptString(cipherText string, key string, iv ...string) (string, error)
- func AesEncrypt(plainText []byte, key string, iv ...string) (ciphertext []byte, err error)
- func AesEncryptString(plainText string, key string, iv ...string) (string, error)
- func AesGCMDecrypt(ciphertext []byte, key string) (plaintext []byte, err error)
- func AesGCMDecryptString(cipherText string, key string) (string, error)
- func AesGCMEncrypt(plaintext []byte, key string) (ciphertext []byte, err error)
- func AesGCMEncryptString(plainText string, key string) (string, error)
- func Base64Decode(data []byte) (value []byte, err error)
- func Base64DecodeString(data string) (value string, err error)
- func Base64Encode(value []byte) []byte
- func Base64EncodeString(value string) string
- func Buffer(size ...int) *strings.Builder
- func Bytes2String(b []byte) string
- func CamelCaseToSnakeCase(str string, delimiter ...string) string
- func Expand(s string, process func(key string) string) string
- func GenRSAKey(bits ...int) (prvkey, pubkey []byte, err error)
- func Img2Base64(path string) (string, error)
- func IsLcfirst(str string) bool
- func IsPattern(str string) bool
- func IsUcfirst(str string) bool
- func Lcfirst(str string) string
- func Len(str string) int
- func Match(str, pattern string) bool
- func Md5(s string) string
- func Md5Byte(s []byte) string
- func Md5File(path string) (encrypt string, err error)
- func NewFilter(words []string, mask ...rune) *filterNode
- func NewReplacer(mapping map[string]string) *replacer
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(origData []byte) ([]byte, error)
- func Pad(raw string, length int, padStr string, padType PadType) string
- func ParseID(id int64) (t time.Time, ts int64, workerId int64, seq int64)
- func ProjectMd5() string
- func RSADecrypt(cipherText []byte, privateKey string, bits ...int) ([]byte, error)
- func RSADecryptString(cipherText string, privateKey string) (string, error)
- func RSAEncrypt(plainText []byte, publicKey string, bits ...int) ([]byte, error)
- func RSAEncryptString(plainText string, publicKey string) (string, error)
- func RSAKeyDecrypt(cipherText []byte, privateKey *rsa.PrivateKey, bits ...int) ([]byte, error)
- func RSAKeyEncrypt(plainText []byte, publicKey *rsa.PublicKey, bits ...int) ([]byte, error)
- func RSAPriKeyEncrypt(plainText []byte, privateKey string) ([]byte, error)
- func RSAPriKeyEncryptString(plainText string, privateKey string) (string, error)
- func RSAPubKeyDecrypt(cipherText []byte, publicKey string) ([]byte, error)
- func RSAPubKeyDecryptString(cipherText string, publicKey string) (string, error)
- func Rand(n int, tpl ...string) string
- func RandInt(min int, max int) int
- func RandUint32() uint32
- func RandUint32Max(max uint32) uint32
- func RegexExtract(pattern string, str string) ([]string, error)
- func RegexExtractAll(pattern string, str string, count ...int) ([][]string, error)
- func RegexFind(pattern string, str string, count int) [][]int
- func RegexMatch(pattern string, str string) bool
- func RegexReplace(pattern string, str, repl string) (string, error)
- func RegexReplaceFunc(pattern string, str string, repl func(string) string) (string, error)
- func RegexSplit(pattern string, str string) ([]string, error)
- func Serialize(value interface{}) ([]byte, error)
- func SnakeCaseToCamelCase(str string, ucfirst bool, delimiter ...string) string
- func String2Bytes(s string) []byte
- func Substr(str string, start int, length ...int) string
- func TrimBOM(fileBytes []byte) []byte
- func TrimLine(s string) string
- func TrimSpace(s string) string
- func UUID() int64
- func Ucfirst(str string) string
- func UnSerialize(valueBytes []byte, registers ...interface{}) (value interface{}, err error)
- func UniqueID(n int) string
- func UrlDecode(str string) (string, error)
- func UrlEncode(str string) string
- func UrlRawDecode(str string) (string, error)
- func UrlRawEncode(str string) string
- func WeightedRand(choices map[interface{}]uint32) (interface{}, error)
- func XSSClean(str string) string
- type IDWorker
- type PadType
- type Template
- type Weighteder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AesDecrypt ¶
AesDecrypt aes decryption
func AesDecryptString ¶
AesDecryptString Aes Decrypt to String
func AesEncrypt ¶
AesEncrypt aes encryption
func AesEncryptString ¶
AesEncryptString Aes Encrypt to String
func AesGCMDecrypt ¶
func AesGCMEncrypt ¶
func Base64Decode ¶
func Base64DecodeString ¶
func Base64Encode ¶
func Base64EncodeString ¶
func CamelCaseToSnakeCase ¶
CamelCaseToSnakeCase camelCase To SnakeCase helloWorld/HelloWorld => hello_world
func Img2Base64 ¶
Img2Base64 read picture files and convert to base 64 strings
func NewReplacer ¶
func PKCS7Padding ¶
PKCS7Padding PKCS7 fill mode
func PKCS7UnPadding ¶
PKCS7UnPadding Reverse operation of padding to delete the padding string
func ProjectMd5 ¶
func ProjectMd5() string
func RSADecrypt ¶
RSADecrypt RSA Decrypt
func RSADecryptString ¶
RSADecryptString RSA Decrypt to String
func RSAEncrypt ¶
RSAEncrypt RSA Encrypt
func RSAEncryptString ¶
RSAEncryptString RSA Encrypt to String
func RSAKeyDecrypt ¶
RSAKeyDecrypt RSA Decrypt
func RSAKeyEncrypt ¶
RSAKeyEncrypt RSA Encrypt
func RSAPriKeyEncrypt ¶
RSAPriKeyEncrypt RSA PriKey Encrypt
func RSAPriKeyEncryptString ¶
RSAPriKeyEncryptString RSA PriKey Encrypt to String
func RSAPubKeyDecrypt ¶
RSAPubKeyDecrypt RSA PubKey Decrypt
func RSAPubKeyDecryptString ¶
RSAPubKeyDecryptString RSA PubKey Decrypt to String
func Rand ¶
Rand random string of specified length, the second parameter limit can only appear the specified character
func RandUint32 ¶
func RandUint32() uint32
func RandUint32Max ¶
RandUint32Max returns pseudorandom uint32 in the range [0..max)
func RegexExtract ¶
RegexExtract extract matching text
func RegexExtractAll ¶
RegexExtractAll extract matching all text
func RegexReplace ¶
RegexReplace replacing matches of the Regexp
func RegexReplaceFunc ¶
RegexReplaceFunc replacing matches of the Regexp
func RegexSplit ¶
RegexSplit split the string
func SnakeCaseToCamelCase ¶
SnakeCaseToCamelCase snakeCase To CamelCase: hello_world => helloWorld
func String2Bytes ¶
String2Bytes string to bytes remark: read only, the structure of runtime changes will be affected, the role of unsafe.Pointer will be changed, and it will also be affected
func UnSerialize ¶
func UrlRawDecode ¶
UrlRawDecode Decode URL-encoded strings.
func UrlRawEncode ¶
UrlRawEncode URL-encode according to RFC 3986.
func WeightedRand ¶
Types ¶
type IDWorker ¶
IDWorker Struct
func NewIDWorker ¶
NewIDWorker Generate NewIDWorker with Given workerid
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
func NewTemplate ¶
func (*Template) ResetTemplate ¶
type Weighteder ¶
type Weighteder struct {
// contains filtered or unexported fields
}
func NewWeightedRand ¶
func NewWeightedRand(choices map[interface{}]uint32) (*Weighteder, error)
func (*Weighteder) Pick ¶
func (w *Weighteder) Pick() interface{}