base64pkg

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: May 15, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README

base64

Base64 编码和解码工具,提供字节函数与 Encryptor 接口。

基础用法

encoded := base64pkg.Encode([]byte("hello"))
decoded, err := base64pkg.Decode(encoded)

注意事项

Base64 不是加密,只适合传输编码;解码外部输入时必须处理错误。

验证

go test ./base64

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(src []byte) ([]byte, error)

Decode 解码

func Encode

func Encode(src []byte) []byte

Encode 编码

func ExampleDecodeString

func ExampleDecodeString(s string) ([]byte, error)

ExampleDecodeString ...

func ExampleEncodeToString

func ExampleEncodeToString(s []byte) string

ExampleEncodeToString ...

Types

type B64

type B64 struct{}

B64 ...

func (*B64) DecryptToString

func (s *B64) DecryptToString(ciphertext string) (string, error)

func (*B64) EncryptToString

func (s *B64) EncryptToString(plaintext string) (string, error)

type Encryptor

type Encryptor interface {
	EncryptToString(plaintext string) (string, error)
	DecryptToString(ciphertext string) (string, error)
}

Encryptor ...

Jump to

Keyboard shortcuts

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