Git Product home page Git Product logo

go-password-hash's Introduction

#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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.