pansy

package module
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 16 Imported by: 0

README

Generate a hex fake ID based on a real ID

InstallInstallation

go get -u github.com/go-pansy/pansy

Usage

    // gen
    faker      := pansy.NewFaker()
    fakerId := faker.GenId(id, true)

    // recover
    id = faker.RecoverId(fakerId)

Documentation

Index

Constants

View Source
const Version = "1.1.0"

Version is the current version of the library.

Variables

View Source
var (
	DEFAULT_CABINET = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"}
)

Functions

func CheckPassword added in v1.0.2

func CheckPassword(password, hash string) bool

func Decode added in v1.0.8

func Decode[T any](args string) (T, error)

func DecodeString added in v1.0.5

func DecodeString[T any](args string, result *T) error

func EncodeToString added in v1.0.5

func EncodeToString[T any]()

func GenPassword added in v1.0.2

func GenPassword(password string) (string, error)

func GetCabinetId added in v1.0.2

func GetCabinetId(name string) int

func GetCabinetName added in v1.0.2

func GetCabinetName(id uint8) string

func ListCabinetNames added in v1.0.2

func ListCabinetNames(end int) []string

func Xor added in v1.0.4

func Xor(payload []string) string

Xor

  • Xor 异或计算

Types

type App added in v1.0.2

type App struct {
}

func NewApp added in v1.0.2

func NewApp() *App

func (*App) GenAppId added in v1.0.2

func (a *App) GenAppId(size int, prefix ...string) string

func (*App) GenAppKey added in v1.0.2

func (a *App) GenAppKey(size int) string

func (*App) GenAppSecret added in v1.0.2

func (a *App) GenAppSecret(size int) string

func (*App) GenCode added in v1.0.2

func (a *App) GenCode(size int) string

func (*App) GenUsername added in v1.0.2

func (a *App) GenUsername(prefix ...string) string

type Faker

type Faker struct {
	// contains filtered or unexported fields
}

func NewFaker

func NewFaker() *Faker

func (*Faker) GenId

func (f *Faker) GenId(id uint, args ...bool) string

func (*Faker) RecoverId

func (f *Faker) RecoverId(id string) uint

type Signatory added in v1.0.3

type Signatory struct {
	// contains filtered or unexported fields
}

func NewSignatory added in v1.0.3

func NewSignatory(appKey string) *Signatory

func (*Signatory) CheckSignature added in v1.0.3

func (s *Signatory) CheckSignature(source map[string]any, sign string) bool

CheckSignature implements board.

func (*Signatory) DecryptBase64String added in v1.0.3

func (s *Signatory) DecryptBase64String(str string) (map[string]any, error)

DecryptBase64String implements board.

func (*Signatory) GenSignature added in v1.0.3

func (s *Signatory) GenSignature(source map[string]any) string

GenSignature implements board.

func (*Signatory) ToBase64String added in v1.0.3

func (s *Signatory) ToBase64String(source map[string]any) (string, error)

ToBase64String implements board.

Jump to

Keyboard shortcuts

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