gocommon

module
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT

README

gocommon

This repository relies only on standard libraries.

crypto/aes
var ecb128pkcs7 = aes.New([]byte("1234567890123456"))
ecb128pkcs7.Encrypt([]byte("msg"))
ecb128pkcs7.Bytes()
ecb128pkcs7.Error

var buf,e = aes.Encrypt([]byte("1234567890123456"), []byte("msg"))
crypto/rsa
injects
package xxstore

type store struct{}

func init(){
	injects.Service.Register(&store{}, &injects.Config{Name:"store:mysql", Step: 10})
}
otp

var totp = otp.NewTOTP("secret", otp.TOTPWithPeriod(60))
var code, _ = totp.Generate()
var ok, _ = totp.Validate(code)
var url = totp.URL("Gcommon", "testid") // return url string. encode qrcode for scan 2FA.
encoding/json
var buf = []byte(`{"a":1,"b":"hello","c":false,"d":{"a":1.234}}`)
var m,_ = json.Parse(buf) 
// map[a:1 b:hello c:false d:map[a:1.234]]
buf,_ = json.Stringify(m)
// []byte({"d":{"a":1.234},"a":1,"b":"hello","c":false})

Directories

Path Synopsis
crypto
aes
rsa
encoding
base100
Fork https://github.com/stek29/base100
Fork https://github.com/stek29/base100
base45
Package base45 implements base45 encoding, fork from https://github.com/xkmsoft/base45
Package base45 implements base45 encoding, fork from https://github.com/xkmsoft/base45
base58
Package base58 implements base58 encoding
Package base58 implements base58 encoding
base62
Package base62 implements base62 encoding, fork from https://github.com/yihleego/base62
Package base62 implements base62 encoding, fork from https://github.com/yihleego/base62
base91
Package base91 implements base91 encoding, fork from https://github.com/mtraver/base91
Package base91 implements base91 encoding, fork from https://github.com/mtraver/base91
bcd
Package bcd provides functions to encode byte arrays to BCD (Binary-Coded Decimal) encoding and back.
Package bcd provides functions to encode byte arrays to BCD (Binary-Coded Decimal) encoding and back.
Package errgroup provides synchronization, error propagation, and Context cancelation for groups of goroutines working on subtasks of a common task.
Package errgroup provides synchronization, error propagation, and Context cancelation for groups of goroutines working on subtasks of a common task.

Jump to

Keyboard shortcuts

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