Package nmihash is used as a source code example for a Go (golang) implementation of the examples found at: // https://support.nmi.com/hc/en-gb/articles/115001683343-Implementation-Generating-a-Hash-Code
- Go 1.14 or newer
- Go Modules
You can run the following command to install nmihash
:
go get -u github.com/jmadore/nmihash
The code is self-contained and doesn't have any external dependencies.
Build
> go build
> go test -v
package main
import (
"fmt"
"github.com/jmadore/nmihash"
)
func main() {
hashKey := "trVxrnoz22bvwvnV"
terminalID := "99999999"
refNum := "0000000765"
amount := "1.23"
hash, err := nmihash.CalculateHash(hashKey, terminalID, refNum, amount)
if err != nil {
fmt.Printf("Hash failed with error %v", err.Error())
return
}
fmt.Println("Base64 Encoded Hash =", hash)
return
}
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Jay Madore - Initial work - jmadore
This project is licensed under the MIT License - see the LICENSE.md file for details