jakepearson / jcpassword Goto Github PK
View Code? Open in Web Editor NEWPassword hasher
Password hasher
Change your program so that when launched your code starts and listens for HTTP
requests on
a provided port. Listen for a POST
to /hash
with a body of the form
password=<the_provided_password>
. The response should be the base64
encoded
string of the SHA512 hash of the provided password. The server should not respond
immediately, it should leave the socket open for 5 seconds before responding.
For example: curl —data “password=angryMonkey” http://localhost:8080/hash
should return ZEHhWB65gUlzdVwtDQArEyx+KVLzp/aTaRaPlBzYRIFj
Modify the /hash
end-point so that it returns an identifier that can be used later to retrieve a
hashed password value. The request should be initiated identically to step 2. The identifier
should return immediately but the password should not be hashed for 5 seconds.
For example: curl —data "password=angryMonkey" http://localhost:8080/hash
should return 42
immediately.
circleci
Provide a statistics endpoint to get basic information about your password hashes.
A GET
request to /stats should return a JSON
object with 2 key/value pairs. The total
key should have a value for the count of password hash requests made to the server so far. The
average
key should have a value for the average time it has taken to process all of those
requests in milliseconds.
For example: curl http://localhost:8080/stats
should return something like:
{"total": 1, "average": 123}
Provide the ability to retrieve an already hashed password with a GET
to /hash/{id}
To continue our example from the last step, 5 seconds after that curl command is issued you
should be able to curl http://localhost:8080/hash/42
and get back the value of
ZEHhWB65gUlzdVwtDQArEyx+KVLzp/aTaRaPlBzYRIFj6vjFdqEb0Q5B8zVKCZ0vKbZP ZklJz0Fd7su2A+gf7Q==
Provide the ability to take a password as a string and return a Base64
encoded string of the
password that has been hashed with SHA512
as the hashing algorithm.
For example, if given the string angryMonkey
the expected return value is
ZEHhWB65gUlzdVwtDQArEyx+KVLzp/aTaRaPlBzYRIFj6vjFdqEb0Q5B8zVKCZ0vKbZP ZklJz0Fd7su2A+gf7Q==
Provide support for a “graceful shutdown request”. If a request is made to /shutdown
all
remaining requests should be allowed to complete, no additional requests should be allowed to
be processed, and the server should stop.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.