README ¶ idkey Golang Argon2id 密码hash和验证 安装方法 go get -u github.com/xiaoqidun/idkey 使用方法 // 生成argon2id hash密码 hash := idkey.Encode([]byte("admin"), nil) // 进行argon2id hash验证 verify := idkey.Verify([]byte("admin"), hash) Expand ▾ Collapse ▴ Documentation ¶ Index ¶ func Encode(password []byte, options *EncodeOptions) string func Verify(password []byte, passwordHash string) bool type Data func Decode(passwordHash string) (data *Data, err error) type EncodeOptions Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ func Encode ¶ func Encode(password []byte, options *EncodeOptions) string Encode 将密码编码成密文 func Verify ¶ func Verify(password []byte, passwordHash string) bool Verify 验证密码编码后是否等于密文 Types ¶ type Data ¶ type Data struct { EncodeOptions // 加密选项 Hash []byte // 密码密文 Salt []byte // 加密盐值 } Data 密文编码结构 func Decode ¶ func Decode(passwordHash string) (data *Data, err error) Decode 获取密文编码结构 type EncodeOptions ¶ type EncodeOptions struct { Time uint32 // 时间参数 Memory uint32 // 内存参数 Threads uint8 // 线程参数 KeyLen uint32 // 密文长度 } EncodeOptions 密文编码选项 Source Files ¶ View all Source files idkey.go Click to show internal directories. Click to hide internal directories.