xyproto/permissions — pull request #2 by jfolkins (2014-11-18 19:21:37+00:00)
Title: Bcrypt Support

I needed bcrypt support. I also saw a TODO in the source, so I figured I'd try and ship it upstream.

# Design Decisions

For backwards compatibility I left sha256 support, setting it as default, and implemented support for bcrypt.

You just have to set the hashing Algo.

# Tests

Basic tests are in place and verifies the proof of work

# Example and comments

I commented things thoroughly and provided an example

# Redis output

Here is the output for Redis using bcrypt. You can see the hashed password starting with $2.

~~~bash
127.0.0.1:6379> DUMP "users:bob"
"\r@\x99\x99\x00\x00\x00\x91\x00\x00\x00\n\x00\x00\bpassword\n<$2a$10$AOQ7lfPqwk3xH/M3LlKMUeNkcfsW056cNdMNa6NH0qCBRFBd6wgAq>\x05email\a\rbob@zombo.com\x0f\bloggedin\n\x04true\x06\tconfirmed\x0b\x05false\a\x05admin\a\x05false\xff\x06\x00\x9e\x1c\xc5\x11w\x8a|\x9c"
127.0.0.1:6379>
~~~

I'll cc Jeremy for some extra eyeballs. @codegangsta

Peace,
Jared