Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecryptWithBase64 ¶
func Encrypt ¶
Encrypt 凯撒密码加密.
PS: 仅加密大小写的英文字母.
@param shift 推荐值: (1) [0, 25]
(2) 不推荐使用 26*n(n >= 0),因为这样加密了个寂寞
func EncryptWithBase64 ¶
EncryptWithBase64 凯撒密码加密 + base64 编码.
PS: (1) base64采用了 base64.RawURLEncoding; (2) 传参 plainText 可以有中文; (3) 返回值可以放到 url 中(但不推荐).
Types ¶
type CaesarCipher ¶
type CaesarCipher struct {
Shift int
}
func NewCaesarCipher ¶
func NewCaesarCipher(shift int) *CaesarCipher
NewCaesarCipher
@param Shift (1) 推荐值: [1, 25]
(2) 不推荐使用 26*n(n >= 0),因为这样加密了个寂寞 (3) 可以是负数,表示向左偏移
func (*CaesarCipher) Decrypt ¶
func (cipher *CaesarCipher) Decrypt(cipherText string) (plainText string)
func (*CaesarCipher) Encrypt ¶
func (cipher *CaesarCipher) Encrypt(plainText string) (cipherText string)
Click to show internal directories.
Click to hide internal directories.