go_toolbox

package module
v0.0.0-...-1174ab3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

README

GO工具箱

authcode

discuz authcode for golang ,and keep the data consistent。
Install
    go get github.com/JonGates/go_toolbox
Usage
    package main
    import (
        "fmt"
        "github.com/JonGates/go_toolbox"
    )
    func main() {
        str := "JonGates"
        encode := go_toolbox.AuthCode(str, "ENCODE", "", 0, 4)
        fmt.Println(encode)
        decode := go_toolbox.AuthCode(encode, "DECODE", "", 0, 4)
        fmt.Println(decode)
    }
Mutual solution of PHP and GO
    Key,ckey_length must be consistent with PHP

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthCode

func AuthCode(str, operation, key string, expiry int64, ckey_length int) string

*

  • $str 明文或密文
  • $operation 加密ENCODE或解密DECODE
  • $key 密钥
  • $expiry 密钥有效期
  • $ckey_length 动态密匙长度,取值越大,密文变动规律越大,为 0 时,则不产生随机密钥
  • 要和php的authcode互解:key,expiry,ckey_length 这三个参数必须和php一致

func Base64_Decode

func Base64_Decode(s string) string

base64 解密

func Base64_Encode

func Base64_Encode(s string) string

base64 加密

func GetMd5String

func GetMd5String(s string) string

生成32位md5字串

Types

This section is empty.

Jump to

Keyboard shortcuts

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