signature

package
v2.31.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2021 License: MIT Imports: 3 Imported by: 0

README

Signature

This module will help you creata HMAC signature based on sha256 & secret key.

Usage

package main

import "github.com/kitabisa/perkakas/v2/signature"

func main() {
    message := "this is my message"
	secretKey := "123-qwe"

    // generate signature
    strSignature := signature.GenerateHmac(message, secretKey)
    
    // check is signature is match
    isSignatureMatch := signature.IsMatchHmac(message, strSignature, secretKey)
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateHmac

func GenerateHmac(data, secretKey string) string

GenerateHmac will transform data into HMAC signature based on sha256 & secret_key

func IsMatchHmac

func IsMatchHmac(data, signature, secretKey string) bool

IsMatchHmac will check whether signature is match with expected HMAC signature

Types

This section is empty.

Jump to

Keyboard shortcuts

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