caesarKit

package
v2.8.157 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2023 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 DecryptWithBase64 added in v2.8.135

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

func Encrypt

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

Encrypt 凯撒密码加密.

PS: 仅加密大小写的英文字母.

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

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

func EncryptWithBase64 added in v2.8.135

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

EncryptWithBase64 凯撒密码加密 + base64 编码.

PS: (1) base64采用了 base64.RawURLEncoding; (2) 传参 plainText 可以有中文; (3) 返回值可以放到 url 中(但不推荐).

Types

type CaesarCipher added in v2.8.135

type CaesarCipher struct {
	Shift int
}

func NewCaesarCipher added in v2.8.135

func NewCaesarCipher(shift int) *CaesarCipher

NewCaesarCipher

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

(2) 不推荐使用 26*n(n >= 0),因为这样加密了个寂寞
(3) 可以是负数,表示向左偏移

func (*CaesarCipher) Decrypt added in v2.8.135

func (cipher *CaesarCipher) Decrypt(cipherText string) (plainText string)

func (*CaesarCipher) Encrypt added in v2.8.135

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