-
Build the app
go build -o ./build/gohasher ./cmd/main.go
-
Run local server
./build/gohasher
Run server on certain port:
./gohasher -port=9090
* Default port is 8080
Get hashed string:
http://localhost:8080/get-hash/?data=...&method=...
Where:
- data - String for hashing
- method - Hash method
Get available hash methods:
http://localhost:8080/hash-methods-list/
If the request is successful, response will be in json format:
{"hash":-8082402883035101391}
If the request is not successful, response will be in json format with error message:
{"error":"unknown hash method"}
{"error":"url param 'data' is missing"}
-
Import package:
import "github.com/R-Romanov/gohasher/pkg/hasher"
-
Call hashing function:
h, err := hasher.Hash("example.com")