encrypt

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

* @Author: reel * @Date: 2023-05-16 21:19:26 * @LastEditors: reel * @LastEditTime: 2023-06-04 22:35:53 * @Description: base62加密解密封装

* @Author: reel * @Date: 2023-05-16 21:15:13 * @LastEditors: reel * @LastEditTime: 2023-06-05 07:53:50 * @Description: 字符串加密

Index

Constants

View Source
const (
	CODE62     = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
	CODE_LENTH = 62
)

Variables

View Source
var (
	InternalPrivKey = []byte(`-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQDkGO3/7Xh2fEpgk1XiQ++6UAkhAjedka+zYstuFdC6N+UAi5ri
zH/j61BfghiW7Lh4vWIgD7L0CwWFogm6GM2rcFHEAJoyrMfTif4HTZTGRsbaWKM5
L2zgzIfEcyYc8r7NYwHIYtX9S5geAglf3u3daEtf3uePbr6C+3C83uY5awIDAQAB
AoGAReo+SUwIuIiwY5nFoW0hdgJCShPb6DhXmqyVnlChgfLQBrLD7vCv4rSmFiBS
WTCF+rxR73HgcF1Qe/2G7bvcjjOnF75mYnN9rOMEc3LO5Fnm+OjK6mf1U0wTrTTS
Jjt1tmK0HYmRToOqJ10ySDWW0+6XYWpImedwhLSmGZGRK4ECQQDkVXcGRFgUpXAv
saABBjNuNr204FBrhSrvrGPuu0Bg7yN9tI2wstc66R5N47wFcjnbB6eGy8rsNg8c
B0OiSONTAkEA/7whRc2izY4lW4E74I+AfAz3bjApD1pDJkZo3vVf6djQ1foixEyk
UdJweGHtJ3zx4iXZJr0AWtfR6HMugrjmiQJANVuvg9xmxPRgQhT9MiAT1raeIG2m
/WlSPk4H0Fsb0Usw/Qg7cEZqu46MkWEdqBwoXwHr6Tkog4iigUdFS+BClwJBAOkW
OqlZrRp3hbsqRj397ZijZN4MjVAN8AgxwqH8ucf1Mxrkms2aIWbmTFacwr/sFLcP
0iWJvIoQDaU1Xl4NUykCQEqL5SpaYS7Z4aTaQk9Meeg5uf9jAE2kP5KZmpGPbhsp
/EOkkbtM/mEfR/JeYx3Ukw8E+2Fq0FiqdBzXmC+LyWc=
-----END RSA PRIVATE KEY-----
`)
	InternalPubKey = []byte(`-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDkGO3/7Xh2fEpgk1XiQ++6UAkh
Ajedka+zYstuFdC6N+UAi5rizH/j61BfghiW7Lh4vWIgD7L0CwWFogm6GM2rcFHE
AJoyrMfTif4HTZTGRsbaWKM5L2zgzIfEcyYc8r7NYwHIYtX9S5geAglf3u3daEtf
3uePbr6C+3C83uY5awIDAQAB
-----END PUBLIC KEY-----
`)
)
View Source
var (
	EDOC = map[string]int{
		"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9,
		"a": 10, "b": 11, "c": 12, "d": 13, "e": 14, "f": 15, "g": 16, "h": 17, "i": 18,
		"j": 19, "k": 20, "l": 21, "m": 22, "n": 23, "o": 24, "p": 25, "q": 26, "r": 27,
		"s": 28, "t": 29, "u": 30, "v": 31, "w": 32, "x": 33, "y": 34, "z": 35, "A": 36,
		"B": 37, "C": 38, "D": 39, "E": 40, "F": 41, "G": 42, "H": 43, "I": 44, "J": 45,
		"K": 46, "L": 47, "M": 48, "N": 49, "O": 50, "P": 51, "Q": 52, "R": 53, "S": 54,
		"T": 55, "U": 56, "V": 57, "W": 58, "X": 59, "Y": 60, "Z": 61}
)

Functions

func B2S

func B2S(b []byte) string

func Decode

func Decode(str string) int

func DecodeWBMid

func DecodeWBMid(str string) string

func Encode

func Encode(num int) string

func EncodeWBMid

func EncodeWBMid(mid string) string

由 mid 生成 base62 编码

func GenerMd5

func GenerMd5(str string) (md5str string)

func InternalDecode

func InternalDecode(str string) (body []byte, err error)

func InternalEncode

func InternalEncode(body []byte) (str string, err error)

func RsaDecrypt

func RsaDecrypt(ciphertext, key []byte) ([]byte, error)

解密

func RsaEncrypt

func RsaEncrypt(data, key []byte) ([]byte, error)

加密

func S2B

func S2B(str string) []byte

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL