GithubHelp home page GithubHelp logo

sha256-service's Introduction

sha256-service

###Dependencies:

Python 2.7.x
pip
virtualenv

###Run:

virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
python run.py

Or to run the tests:

python test.py

###Caveats

For the sake of this challenge, I am holding data entered by the user in memory. The data does not persistence after killing the server, and concurrent requests are sure to cause problems.

The SHA256 hash created is with hex encoding. To retreive the data associated with that hash, the hash must be entered in hex.

###Endpoints:

####POST /hash/ Request Headers Content-Type must be "application/json"

Example:

Request

"headers": {
  "content-type": "application/json"
},
"data": {
  "foo": "bar"
}

Response

201
{
  "hash": "426fc04f04bf8fdb5831dc37bbb6dcf70f63a37e05a68c6ea5f63e85ae579376"
}

Error Responses

400 - Content-Type not application/json

400 - Post Data not valid JSON

####GET /hash/:hash

Example:

Request

GET /hash/426fc04f04bf8fdb5831dc37bbb6dcf70f63a37e05a68c6ea5f63e85ae579376/

Response

200
{
  "foo": "bar"
}

Error Responses

400 - not a valid SHA256 Hash

404 - resource not found

sha256-service's People

Contributors

scoin avatar

Watchers

James Cloos avatar  avatar

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.