Documentation ¶
Index ¶
- Constants
- Variables
- func AESDec(key []byte, data []byte, iv []byte, mode string) ([]byte, error)
- func AESDecWithPassphrase(passphrase, data, salt []byte, KDF KeyDerivationFunc, aesMode string) ([]byte, error)
- func AESEnc(key []byte, data []byte, iv []byte, mode string) ([]byte, error)
- func AESEncWithPassphrase(passphrase, data, salt []byte, KDF KeyDerivationFunc, aesMode string) ([]byte, error)
- func AESGCMDecrypt(key []byte, data interface{}, nonce []byte) ([]byte, error)
- func AESGCMDecryptWithNonceSize(key []byte, data interface{}, nonceRaw []byte, nonceSize int) ([]byte, error)
- func AESGCMDecryptWithNonceSize12(key []byte, data interface{}, nonce []byte) ([]byte, error)
- func AESGCMDecryptWithNonceSize16(key []byte, data interface{}, nonce []byte) ([]byte, error)
- func AESGCMEncrypt(key []byte, data interface{}, nonceRaw []byte) ([]byte, error)
- func AESGCMEncryptWithNonceSize(key []byte, data interface{}, nonceRaw []byte, nonceSize int) ([]byte, error)
- func AESGCMEncryptWithNonceSize12(key []byte, data interface{}, nonceRaw []byte) ([]byte, error)
- func AllASCII(i any) bool
- func AnyToBytes(i interface{}) (result []byte)
- func AnyToString(i interface{}) (result string)
- func Atob(i string) bool
- func Atof(i string) float64
- func Atoi(i string) int
- func Atoi64(i string) int64
- func BlockCheck(iv, data []byte, blockSize int) error
- func CBCDecode(c cipher.Block, iv, data []byte) ([]byte, error)
- func CBCEncode(c cipher.Block, iv, data []byte) ([]byte, error)
- func CFBDecode(c cipher.Block, iv, data []byte) ([]byte, error)
- func CFBEncode(c cipher.Block, iv, data []byte) ([]byte, error)
- func CTRDecode(c cipher.Block, iv, data []byte) ([]byte, error)
- func CTREncode(c cipher.Block, iv, data []byte) ([]byte, error)
- func CharDetect(raw interface{}) ([]chardet.Result, error)
- func CharDetectBest(raw interface{}) (*chardet.Result, error)
- func Cmac(alg string, key []byte, message []byte) ([]byte, error)
- func DESDec(key []byte, data []byte, iv []byte, mode string) ([]byte, error)
- func DESECBDec(key []byte, data []byte) ([]byte, error)
- func DESECBEnc(key []byte, data []byte) ([]byte, error)
- func DESEnc(key []byte, data []byte, iv []byte, mode string) ([]byte, error)
- func DecodeBase32(i string) ([]byte, error)
- func DecodeBase64(i string) ([]byte, error)
- func DecodeBase64Url(i interface{}) ([]byte, error)
- func DecodeHex(i string) ([]byte, error)
- func Decodebig5(s []byte) ([]byte, error)
- func Decodegbk(s []byte) ([]byte, error)
- func ECBDecode(c cipher.Block, data []byte) ([]byte, error)
- func ECBEncode(c cipher.Block, data []byte) ([]byte, error)
- func EncodeBase32(i interface{}) string
- func EncodeBase64(i interface{}) string
- func EncodeBase64Url(i interface{}) string
- func EncodeByType(t string, i interface{}) string
- func EncodeHtmlEntity(i interface{}) string
- func EncodeHtmlEntityEx(i interface{}, encodeType string, fullEncode bool) string
- func EncodeHtmlEntityHex(i interface{}) string
- func EncodeToHex(i interface{}) string
- func EncodeUrlCode(i interface{}) string
- func Encodebig5(s []byte) ([]byte, error)
- func Equal(mac1, mac2 []byte) bool
- func EscapeInvalidUTF8Byte(s []byte) string
- func FixIV(iv, key []byte, blockSize int) []byte
- func ForceQueryUnescape(s string) string
- func GB18030ToUtf8(s []byte) ([]byte, error)
- func GBKSafeString(s []byte) (string, error)
- func GbkToUtf8(s []byte) ([]byte, error)
- func GenerateSM2PrivateKeyHEX() ([]byte, []byte, error)
- func GenerateSM2PrivateKeyPEM() ([]byte, []byte, error)
- func HTTPChunkedDecode(raw []byte) ([]byte, error)
- func HTTPChunkedDecodeWithRestBytes(raw []byte) ([]byte, []byte)
- func HTTPChunkedDecoderWithRestBytes(raw io.Reader) ([]byte, []byte, io.Reader, error)
- func HTTPChunkedEncode(raw []byte) []byte
- func HZGB2312ToUtf8(s []byte) ([]byte, error)
- func HmacMD5(key, data interface{}) []byte
- func HmacSM3(key, data interface{}) []byte
- func HmacSha1(key, data interface{}) []byte
- func HmacSha256(key, data interface{}) []byte
- func HmacSha512(key, data interface{}) []byte
- func HtmlCharsetPrescan(content []byte, callback ...func(start, end int, matched PrescanResult)) (e encoding.Encoding, name string)
- func IsControl(r rune) bool
- func IsGBK(data []byte) bool
- func IsUtf8(data []byte) bool
- func Itoa(i int) string
- func JsonUnicodeDecode(i string) string
- func JsonUnicodeEncode(i string) string
- func MMH3Hash128(i interface{}) string
- func MMH3Hash128x64(i interface{}) string
- func MMH3Hash32(i interface{}) int64
- func Md5(i interface{}) string
- func MustPKCS5UnPadding(origData []byte) ([]byte, error)
- func OFBDecode(c cipher.Block, iv, data []byte) ([]byte, error)
- func OFBEncode(c cipher.Block, iv, data []byte) ([]byte, error)
- func PKCS5Padding(ciphertext []byte, blockSize int) []byte
- func PKCS5UnPadding(origData []byte) []byte
- func PKCS7PaddingFor8ByteBlock(src []byte) []byte
- func PKCS7UnPaddingFor8ByteBlock(src []byte) []byte
- func PathUnescape(s string) (string, error)
- func QueryEscape(s string) string
- func QueryUnescape(s string) (string, error)
- func RC4Decrypt(cipherKey []byte, cipherText []byte) ([]byte, error)
- func RC4Encrypt(cipherKey []byte, plainText []byte) ([]byte, error)
- func RandBytes(n int) []byte
- func RandomUpperAndLower(s string) string
- func ReadHTTPChunkedDataWithFixed(raw []byte) (data []byte, fixedChunked []byte, rest []byte)
- func ReadHTTPChunkedDataWithFixedError(raw []byte) (data []byte, fixedChunked []byte, rest []byte, _ error)
- func SM2DecryptASN1(priKey []byte, data []byte) ([]byte, error)
- func SM2DecryptASN1WithPassword(priKey []byte, data []byte, password []byte) ([]byte, error)
- func SM2DecryptC1C2C3(priKey []byte, data []byte) ([]byte, error)
- func SM2DecryptC1C2C3WithPassword(priKey []byte, data []byte, password []byte) ([]byte, error)
- func SM2DecryptC1C3C2(priKey []byte, data []byte) ([]byte, error)
- func SM2DecryptC1C3C2WithPassword(priKey []byte, data []byte, password []byte) ([]byte, error)
- func SM2EncryptASN1(pubKey []byte, data []byte) ([]byte, error)
- func SM2EncryptC1C2C3(pubKey []byte, data []byte) ([]byte, error)
- func SM2EncryptC1C3C2(pubKey []byte, data []byte) ([]byte, error)
- func SM3(raw interface{}) []byte
- func SM4Dec(key, data, iv []byte, mode string) ([]byte, error)
- func SM4Enc(key, data, iv []byte, mode string) ([]byte, error)
- func SM4GCMDec(key []byte, data interface{}, iv []byte) ([]byte, error)
- func SM4GCMEnc(key []byte, data interface{}, iv []byte) ([]byte, error)
- func Sha1(i interface{}) string
- func Sha224(i interface{}) string
- func Sha256(i interface{}) string
- func Sha384(i interface{}) string
- func Sha512(i interface{}) string
- func ShrinkString(r any, size int) string
- func ShrinkStringDefault(r any) string
- func StrConvUnquoteForce(s string) []byte
- func TripleDES_ECBDec(key []byte, data []byte) ([]byte, error)
- func TripleDES_ECBEnc(key []byte, data []byte) ([]byte, error)
- func TripleDesDec(key []byte, data []byte, iv []byte, mode string) ([]byte, error)
- func TripleDesEnc(key []byte, data []byte, iv []byte, mode string) ([]byte, error)
- func UTF8AndControlEscapeForEditorView(i any) string
- func UTF8SafeEscape(i any) string
- func UrlUnicodeDecode(s string) string
- func Utf8ToGB18030(s []byte) ([]byte, error)
- func Utf8ToGbk(s []byte) ([]byte, error)
- func Utf8ToHZGB2312(s []byte) ([]byte, error)
- func ZeroPadding(origin []byte, blockSize int) []byte
- func ZeroUnPadding(originData []byte) []byte
- type AutoDecodeResult
- type CmacBuilder
- type EncodedFunc
- type KeyDerivationFunc
- type MIMEResult
- type NewCipherFunc
- type PrescanResult
- type SymmetricCryptFunc
- func AESDecFactory(unpaddingFunc func([]byte) []byte, mode string) SymmetricCryptFunc
- func AESEncFactory(paddingFunc func([]byte, int) []byte, mode string) SymmetricCryptFunc
- func DESDecFactory(unpaddingFunc func([]byte) []byte, mode string) SymmetricCryptFunc
- func DESEncFactory(paddingFunc func([]byte, int) []byte, mode string) SymmetricCryptFunc
- func SM4DecFactory(unpaddingFunc func([]byte) []byte, mode string) SymmetricCryptFunc
- func SM4EncFactory(paddingFunc func([]byte, int) []byte, mode string) SymmetricCryptFunc
- func TripleDESDecFactory(unpaddingFunc func([]byte) []byte, mode string) SymmetricCryptFunc
- func TripleDESEncFactory(paddingFunc func([]byte, int) []byte, mode string) SymmetricCryptFunc
Constants ¶
const DefaultBytesToKeyIterations = 1
const DefaultPBKDF2Iterations = 10000
Variables ¶
var ( EscapeHtmlString = html.EscapeString UnescapeHtmlString = html.UnescapeString StrConvQuote = func(s string) string { raw := []byte(s) var buf bytes.Buffer buf.WriteString("\"") for _, b := range raw { switch true { case b >= 'a' && b <= 'z': fallthrough case b >= 'A' && b <= 'Z': fallthrough case b >= '0' && b <= '9': buf.WriteByte(b) default: buf.WriteString(fmt.Sprintf(`\x%02x`, b)) } } buf.WriteString("\"") return buf.String() } )
var ( // BytesToKeyMD5 utilizes MD5 key-derivation (`-md md5`) BytesToKeyMD5 = NewBytesToKeyGenerator(md5.New, DefaultBytesToKeyIterations) // BytesToKeySHA1 utilizes SHA1 key-derivation (`-md sha1`) BytesToKeySHA1 = NewBytesToKeyGenerator(sha1.New, DefaultBytesToKeyIterations) // BytesToKeySHA256 utilizes SHA256 key-derivation (`-md sha256`) BytesToKeySHA256 = NewBytesToKeyGenerator(sha256.New, DefaultBytesToKeyIterations) // BytesToKeySHA384 utilizes SHA384 key-derivation (`-md sha384`) BytesToKeySHA384 = NewBytesToKeyGenerator(sha512.New384, DefaultBytesToKeyIterations) // BytesToKeySHA512 utilizes SHA512 key-derivation (`-md sha512`) BytesToKeySHA512 = NewBytesToKeyGenerator(sha512.New, DefaultBytesToKeyIterations) // PBKDF2MD5 utilizes PBKDF2 key derivation with MD5 hashing (`-pbkdf2 -md md5`) PBKDF2MD5 = NewPBKDF2Generator(md5.New, DefaultPBKDF2Iterations) // PBKDF2SHA1 utilizes PBKDF2 key derivation with SHA1 hashing (`-pbkdf2 -md sha1`) PBKDF2SHA1 = NewPBKDF2Generator(sha1.New, DefaultPBKDF2Iterations) // PBKDF2SHA256 utilizes PBKDF2 key derivation with SHA256 hashing (`-pbkdf2 -md sha256`) PBKDF2SHA256 = NewPBKDF2Generator(sha256.New, DefaultPBKDF2Iterations) // PBKDF2SHA384 utilizes PBKDF2 key derivation with SHA384 hashing (`-pbkdf2 -md sha384`) PBKDF2SHA384 = NewPBKDF2Generator(sha512.New384, DefaultPBKDF2Iterations) // PBKDF2SHA512 utilizes PBKDF2 key derivation with SHA512 hashing (`-pbkdf2 -md sha512`) PBKDF2SHA512 = NewPBKDF2Generator(sha512.New, DefaultPBKDF2Iterations) )
var ( CBC = "CBC" ECB = "ECB" CFB = "CFB" OFB = "OFB" CTR = "CTR" )
var AESCBCDecrypt = AESDecryptCBCWithPKCSPadding
var AESCBCEncrypt = AESEncryptCBCWithPKCSPadding
var AESDecryptCBCWithPKCSPadding = AESDecFactory(PKCS5UnPadding, CBC)
var AESDecryptCBCWithZeroPadding = AESDecFactory(ZeroUnPadding, CBC)
var AESDecryptECBWithPKCSPadding = AESDecFactory(PKCS5UnPadding, ECB)
var AESDecryptECBWithZeroPadding = AESDecFactory(ZeroUnPadding, ECB)
var AESECBDecrypt = AESDecryptECBWithPKCSPadding
var AESECBEncrypt = AESEncryptECBWithPKCSPadding
var AESEncryptCBCWithPKCSPadding = AESEncFactory(PKCS5Padding, CBC)
var AESEncryptCBCWithZeroPadding = AESEncFactory(ZeroPadding, CBC)
var AESEncryptECBWithPKCSPadding = AESEncFactory(PKCS5Padding, ECB)
var AESEncryptECBWithZeroPadding = AESEncFactory(ZeroPadding, ECB)
var AESGCMEncryptWithNonceSize16 = AESGCMEncrypt
var DESDecryptCBCWithPKCSPadding = DESDecFactory(PKCS5UnPadding, CBC)
var DESDecryptCBCWithZeroPadding = DESDecFactory(ZeroUnPadding, CBC)
var DESDecryptECBWithPKCSPadding = DESDecFactory(PKCS5UnPadding, ECB)
var DESDecryptECBWithZeroPadding = DESDecFactory(ZeroUnPadding, ECB)
var DESEncryptCBCWithPKCSPadding = DESEncFactory(PKCS5Padding, CBC)
Des
var DESEncryptCBCWithZeroPadding = DESEncFactory(ZeroPadding, CBC)
var DESEncryptECBWithPKCSPadding = DESEncFactory(PKCS5Padding, ECB)
var DESEncryptECBWithZeroPadding = DESEncFactory(ZeroPadding, ECB)
var DoubleDecodeUrl = func(i string) (string, error) { raw, err := url.QueryUnescape(i) if err != nil { return "", err } return url.QueryUnescape(raw) }
var DoubleEncodeUrl = func(i interface{}) string { return url.QueryEscape(EncodeUrlCode(i)) }
var PKCS7Padding = sm4.PKCS7Padding
var PKCS7UnPadding = sm4.PKCS7UnPadding
var PathEscape = url.PathEscape
var SM4DecryptCBCWithPKCSPadding = SM4DecFactory(PKCS5UnPadding, CBC)
var SM4DecryptCBCWithZeroPadding = SM4DecFactory(ZeroUnPadding, CBC)
var SM4DecryptCFBWithPKCSPadding = SM4DecFactory(PKCS5UnPadding, CFB)
var SM4DecryptCFBWithZeroPadding = SM4DecFactory(ZeroUnPadding, CFB)
var SM4DecryptCTRWithPKCSPadding = SM4DecFactory(PKCS5UnPadding, CTR)
var SM4DecryptCTRWithZeroPadding = SM4DecFactory(ZeroUnPadding, CTR)
var SM4DecryptECBWithPKCSPadding = SM4DecFactory(PKCS5UnPadding, ECB)
var SM4DecryptECBWithZeroPadding = SM4DecFactory(ZeroUnPadding, ECB)
var SM4DecryptOFBWithPKCSPadding = SM4DecFactory(PKCS5UnPadding, OFB)
var SM4DecryptOFBWithZeroPadding = SM4DecFactory(ZeroUnPadding, OFB)
var SM4EncryptCBCWithPKCSPadding = SM4EncFactory(PKCS5Padding, CBC)
Construct functions corresponding to various encryption modes
var SM4EncryptCBCWithZeroPadding = SM4EncFactory(ZeroPadding, CBC)
var SM4EncryptCFBWithPKCSPadding = SM4EncFactory(PKCS5Padding, CFB)
var SM4EncryptCFBWithZeroPadding = SM4EncFactory(ZeroPadding, CFB)
var SM4EncryptCTRWithPKCSPadding = SM4EncFactory(PKCS5Padding, CTR)
var SM4EncryptCTRWithZeroPadding = SM4EncFactory(ZeroPadding, CTR)
var SM4EncryptECBWithPKCSPadding = SM4EncFactory(PKCS5Padding, ECB)
var SM4EncryptECBWithZeroPadding = SM4EncFactory(ZeroPadding, ECB)
var SM4EncryptOFBWithPKCSPadding = SM4EncFactory(PKCS5Padding, OFB)
var SM4EncryptOFBWithZeroPadding = SM4EncFactory(ZeroPadding, OFB)
var StrConvUnquote = strconv.Unquote
var TripleDESDecryptCBCWithPKCSPadding = TripleDESDecFactory(PKCS5UnPadding, CBC)
var TripleDESDecryptCBCWithZeroPadding = TripleDESDecFactory(ZeroUnPadding, CBC)
var TripleDESDecryptECBWithPKCSPadding = TripleDESDecFactory(PKCS5UnPadding, ECB)
var TripleDESDecryptECBWithZeroPadding = TripleDESDecFactory(ZeroUnPadding, ECB)
var TripleDESEncryptCBCWithPKCSPadding = TripleDESEncFactory(PKCS5Padding, CBC)
TripleDes
var TripleDESEncryptCBCWithZeroPadding = TripleDESEncFactory(ZeroPadding, CBC)
var TripleDESEncryptECBWithPKCSPadding = TripleDESEncFactory(PKCS5Padding, ECB)
var TripleDESEncryptECBWithZeroPadding = TripleDESEncFactory(ZeroPadding, ECB)
Functions ¶
func AESDecWithPassphrase ¶
func AESDecWithPassphrase(passphrase, data, salt []byte, KDF KeyDerivationFunc, aesMode string) ([]byte, error)
func AESEncWithPassphrase ¶
func AESEncWithPassphrase(passphrase, data, salt []byte, KDF KeyDerivationFunc, aesMode string) ([]byte, error)
func AESGCMEncrypt ¶
//AES GCM 加密后的payload shiro 1.4.2版本更换为了AES-GCM加密方式
func AES_GCM_Encrypt(key []byte, Content []byte) string { block, _ := aes.NewCipher(key) nonce := make([]byte, 16) io.ReadFull(rand.Reader, nonce) aesgcm, _ := cipher.NewGCMWithNonceSize(block, 16) ciphertext := aesgcm.Seal(nil, nonce, Content, nil) return base64.StdEncoding.EncodeToString(append(nonce, ciphertext...)) }
func AnyToBytes ¶ added in v1.2.6
func AnyToBytes(i interface{}) (result []byte)
func AnyToString ¶ added in v1.2.6
func AnyToString(i interface{}) (result string)
func BlockCheck ¶ added in v1.3.3
func CharDetect ¶
func CharDetectBest ¶
func DecodeBase32 ¶ added in v1.2.4
func DecodeBase64 ¶
func DecodeBase64Url ¶
func EncodeBase32 ¶ added in v1.2.4
func EncodeBase32(i interface{}) string
func EncodeBase64 ¶
func EncodeBase64(i interface{}) string
func EncodeBase64Url ¶
func EncodeBase64Url(i interface{}) string
func EncodeByType ¶ added in v1.2.8
func EncodeHtmlEntity ¶
func EncodeHtmlEntity(i interface{}) string
func EncodeHtmlEntityEx ¶ added in v1.3.1
todo replace HtmlEntityEncode
func EncodeHtmlEntityHex ¶
func EncodeHtmlEntityHex(i interface{}) string
func EncodeToHex ¶
func EncodeToHex(i interface{}) string
func EncodeUrlCode ¶
func EncodeUrlCode(i interface{}) string
func Equal ¶ added in v1.3.3
Equal compares two MACs for equality without leaking timing information.
func EscapeInvalidUTF8Byte ¶
func ForceQueryUnescape ¶ added in v1.2.8
func GB18030ToUtf8 ¶
func GBKSafeString ¶
func HTTPChunkedDecode ¶
func HTTPChunkedDecodeWithRestBytes ¶ added in v1.2.6
func HTTPChunkedDecoderWithRestBytes ¶ added in v1.2.6
func HTTPChunkedEncode ¶
func HZGB2312ToUtf8 ¶
func HmacSha256 ¶
func HmacSha256(key, data interface{}) []byte
func HmacSha512 ¶
func HmacSha512(key, data interface{}) []byte
func HtmlCharsetPrescan ¶
func JsonUnicodeDecode ¶
func JsonUnicodeEncode ¶
func MMH3Hash128 ¶
func MMH3Hash128(i interface{}) string
func MMH3Hash128x64 ¶
func MMH3Hash128x64(i interface{}) string
func MMH3Hash32 ¶
func MMH3Hash32(i interface{}) int64
func MustPKCS5UnPadding ¶ added in v1.2.2
func PKCS5Padding ¶
func PKCS5UnPadding ¶
func PKCS7PaddingFor8ByteBlock ¶ added in v1.3.3
func PKCS7UnPaddingFor8ByteBlock ¶ added in v1.3.3
func PathUnescape ¶
func QueryEscape ¶
func QueryUnescape ¶
func RandomUpperAndLower ¶
func ReadHTTPChunkedDataWithFixed ¶ added in v1.2.6
func ReadHTTPChunkedDataWithFixedError ¶ added in v1.3.3
func SM4GCMEnc ¶
func sm4encBase(data interface{}, key []byte, iv []byte, sm4ordinary func(key, in []byte, encode bool, iv []byte) ([]byte, error)) ([]byte, error) { return sm4ordinary(key, interfaceToBytes(data), true, iv) }
func sm4decBase(data interface{}, key []byte, iv []byte, sm4ordinary func(key, in []byte, encode bool, iv []byte) ([]byte, error)) ([]byte, error) { return sm4ordinary(key, interfaceToBytes(data), false, iv) }
func SM4CFBEnc(key []byte, data interface{}, iv []byte) ([]byte, error) { return sm4encBase(data, key, iv, sm4.Sm4CFB) }
func SM4CBCEnc(key []byte, data interface{}, iv []byte) ([]byte, error) { return sm4encBase(data, key, iv, sm4.Sm4Cbc) }
func SM4ECBEnc(key []byte, data interface{}, iv []byte) ([]byte, error) { return sm4encBase(data, key, iv, sm4.Sm4Ecb) }
func SM4OFBEnc(key []byte, data interface{}, iv []byte) ([]byte, error) { return sm4encBase(data, key, iv, sm4.Sm4OFB) }
func SM4CFBDec(key []byte, data interface{}, iv []byte) ([]byte, error) { return sm4decBase(data, key, iv, sm4.Sm4CFB) }
func SM4CBCDec(key []byte, data interface{}, iv []byte) ([]byte, error) { return sm4decBase(data, key, iv, sm4.Sm4Cbc) }
func SM4ECBDec(key []byte, data interface{}, iv []byte) ([]byte, error) { return sm4decBase(data, key, iv, sm4.Sm4Ecb) }
func SM4OFBDec(key []byte, data interface{}, iv []byte) ([]byte, error) { return sm4decBase(data, key, iv, sm4.Sm4OFB) }
func ShrinkString ¶
func ShrinkStringDefault ¶
func StrConvUnquoteForce ¶ added in v1.2.8
func TripleDES_ECBDec ¶ added in v1.2.4
func TripleDES_ECBEnc ¶ added in v1.2.4
func TripleDesDec ¶ added in v1.3.3
func TripleDesEnc ¶ added in v1.3.3
func UTF8AndControlEscapeForEditorView ¶ added in v1.3.3
UTF8AndControlEscapeForEditorView will remove some unfriendly chars for editor
func UTF8SafeEscape ¶ added in v1.3.3
func UrlUnicodeDecode ¶ added in v1.2.9
func Utf8ToGB18030 ¶
func Utf8ToHZGB2312 ¶
func ZeroPadding ¶
func ZeroUnPadding ¶
Types ¶
type AutoDecodeResult ¶
func AutoDecode ¶
func AutoDecode(i interface{}) []*AutoDecodeResult
type CmacBuilder ¶ added in v1.3.3
type CmacBuilder struct {
// contains filtered or unexported fields
}
func New ¶ added in v1.3.3
func New(newCipher NewCipherFunc, key []byte) (*CmacBuilder, error)
New returns a new CMAC hash using the given cipher instantiation function and key.
func (*CmacBuilder) BlockSize ¶ added in v1.3.3
func (c *CmacBuilder) BlockSize() int
func (*CmacBuilder) Size ¶ added in v1.3.3
func (c *CmacBuilder) Size() int
func (*CmacBuilder) Sum ¶ added in v1.3.3
func (c *CmacBuilder) Sum(m []byte) []byte
Sum returns the CMAC appended to m. m may be nil. Write may be called after Sum.
type EncodedFunc ¶ added in v1.3.3
type KeyDerivationFunc ¶
func NewBytesToKeyGenerator ¶
func NewBytesToKeyGenerator(hashFunc func() hash.Hash, iterations int) KeyDerivationFunc
func NewPBKDF2Generator ¶
func NewPBKDF2Generator(hashFunc func() hash.Hash, iterations int) KeyDerivationFunc
type MIMEResult ¶
func MatchMIMEType ¶
func MatchMIMEType(raw any) (*MIMEResult, error)
MatchMIMEType will match via bytes note: if the raw input is overlarge, check the first n(4k) bytes to detect question: fix the tail, if the raw input is text (not structured file)
func (*MIMEResult) TryUTF8Convertor ¶
func (t *MIMEResult) TryUTF8Convertor(raw []byte) ([]byte, bool)
type NewCipherFunc ¶ added in v1.3.3
NewCipherFunc instantiates a block cipher
type PrescanResult ¶
type SymmetricCryptFunc ¶ added in v1.3.3
func AESDecFactory ¶ added in v1.3.3
func AESDecFactory(unpaddingFunc func([]byte) []byte, mode string) SymmetricCryptFunc
func AESEncFactory ¶ added in v1.3.3
func AESEncFactory(paddingFunc func([]byte, int) []byte, mode string) SymmetricCryptFunc
func DESDecFactory ¶ added in v1.3.3
func DESDecFactory(unpaddingFunc func([]byte) []byte, mode string) SymmetricCryptFunc
func DESEncFactory ¶ added in v1.3.3
func DESEncFactory(paddingFunc func([]byte, int) []byte, mode string) SymmetricCryptFunc
func SM4DecFactory ¶ added in v1.3.3
func SM4DecFactory(unpaddingFunc func([]byte) []byte, mode string) SymmetricCryptFunc
func SM4EncFactory ¶ added in v1.3.3
func SM4EncFactory(paddingFunc func([]byte, int) []byte, mode string) SymmetricCryptFunc
func TripleDESDecFactory ¶ added in v1.3.3
func TripleDESDecFactory(unpaddingFunc func([]byte) []byte, mode string) SymmetricCryptFunc
func TripleDESEncFactory ¶ added in v1.3.3
func TripleDESEncFactory(paddingFunc func([]byte, int) []byte, mode string) SymmetricCryptFunc