caesarKit

package
v3.0.90 Latest Latest
Warning

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

Go to latest
Published: May 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(cipherText string, shift int) (plainText string)

func DecryptWithRawURLBase64 added in v3.0.24

func DecryptWithRawURLBase64(cipherText string, shift int) (plainText string, err error)

func Encrypt

func Encrypt(plainText string, shift int) (cipherText string)

Encrypt 凯撒密码加密.

PS: 仅加密大小写的英文字母,不会动中文.

@param shift 推荐值: (1) [1, 25]

(2) 不推荐使用 26*n,因为这样加密了个寂寞

func EncryptWithRawURLBase64 added in v3.0.24

func EncryptWithRawURLBase64(plainText string, shift int) (cipherText string)

EncryptWithRawURLBase64 凯撒密码加密 + 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)

Jump to

Keyboard shortcuts

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