grapeSign

package
v0.0.0-...-5771147 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

直接根据类型生成指定的MD5或SHA1的SIGN 用于API或任何参数校验,时间参数t建议自己加在结构中 基本算法为 value组合+_+key 或 key=value组合+_+key 建议传入的是一个结构体,不要是map之类的,因为map是无序的,如果传入MAP自动按照名称排序一次 实现自动化以后可以少写好多代码并且可以验证一个包或一个API的参数是否合法 version 1.0 beta by koangel email: jackliu100@gmail.com 2017/09/08

Index

Constants

This section is empty.

Variables

View Source
var (
	IsUseKey     bool   = true   // 是否只使用数值组合生成 [key=value]
	IsSort       bool   = true   // 是否对key做字母排序,默认开启排序,可不排序直接生成
	SignKey      string = ""     // 一个默认的KEY
	SignTag      string = "sign" // 可以根据json或form等来生成sign,设置为 - 时代表不做任何生成行为
	SignSplitTag string = "_"    // 默认下划线分割
	SignMergeTag string = "&"    // join时用的数据,可以自行设置
	SignSkipKey  string = "sign"
)

Functions

func KeySignMD5

func KeySignMD5(t interface{}, key string) (sign string, err error)

func KeySignMD5NE

func KeySignMD5NE(t interface{}, key string) string

func KeySignSha1

func KeySignSha1(t interface{}, key string) (sign string, err error)

func KeySignSha1NE

func KeySignSha1NE(t interface{}, key string) string

func SignMD5

func SignMD5(t interface{}) (sign string, err error)

func SignMD5NE

func SignMD5NE(t interface{}) string

func SignSha1

func SignSha1(t interface{}) (sign string, err error)

func SignSha1NE

func SignSha1NE(t interface{}) string

func SortMap2Str

func SortMap2Str(tmap map[string]interface{}) string

func Type2Map

func Type2Map(t interface{}) (tmap map[string]interface{}, err error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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