A small application that can take a plain text password, hash it and keep some basic metrics about the process
In the root directory run:
go run cmd/main.go
The applications offers 4 endpoints:
Takes a plain text password, hashes it, base64 encodes it and stores for later use
curl --data "password=angryMonkey" http://localhost:8080/hash
Example Response:
1
Fetch the password after it has been stored
curl http://localhost:8080/hash/1
Example Response:
"7iaw3Ur350mqGo7jwQrpkj9hiYB3Lkc/iBml1JQODbJ6wYX4oOHV+E+IvIh/1nsUNzLDBMxfqa2Ob1f1ACio/w=="
Get basic statistics about the Password Hash
endpoint
curl http://localhost:8080/stats
Example Response:
{
"total":2,
"average":0.0914775
}
Gracefully shutsdown the application and lets any inflight processes finish
curl http://localhost:8080/shutdown
Example Response:
OK
Included in the tests/
directory is a ./load_test.sh
script for running many hash requests
against the Hash Password
endpoint.
Along with the load test, a postman Library is also available in the tests/postman
directory.
The Go language is new to me. I used documentation and many tutorials to figure out how the mux server, middleware, and session storage work