mkboice / Go-Password-Hash

Take home project for interview process. Main submission in NodeJS: https://github.com/mkboice/Node-Password-Hash

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

#Go Password Hash

##Setup

  1. go build main.go
  2. gofmt -w main.go - To format the code if needed

##Run

  1. ./main - Start the server
  2. go test -v - to run tests (Server is started within the tests. Don't need to run ./main.)

##Requirements

  • The project should be written in Go using only the standard library.
  • When launched it should monitor a given port and wait for http connections.
  • When a connection is made it should not respond immediately, but rather hold the socket open for 5 seconds and then respond.
  • The connection will be a POST request containing a value that the client wishes to be hashed.
  • The hashing algorithm should be SHA512.
  • The result should be returned base64 encoded.
  • The software should be able to process multiple connections simultaneously.
  • If, instead of a password request the software receives a "graceful shutdown" request, it should allow any remaining password requests to complete, reject any new requests, and shutdown.
  • No additional password requests should be allowed when shutdown is pending.

##Example For instance, given the request (generated by curl): curl --data "password=angryMonkey" http://localhost:8080

Your program should return ZEHhWB65gUlzdVwtDQArEyx+KVLzp/aTaRaPlBzYRIFj6vjFdqEb0Q5B8zVKCZ0vKbZPZklJz0Fd7su2A+gf7Q==

##Asumptions

  • Status code 400 'Bad Form Parameter' is returned if the form key is not "password"
  • Status code 404 'Not Found' is returned on any request other than a POST

##More to do

  1. Graceful shutdown and corresponding tests
  2. Test for multiple asynchronous requests

About

Take home project for interview process. Main submission in NodeJS: https://github.com/mkboice/Node-Password-Hash


Languages

Language:Go 100.0%