SixArm.com » Ruby » Password Hash to do secure SHA256 passwords.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.codeclimate/badges
.yardoc
doc
lib
test
.codeclimate.yml
.document
.gemtest
.gitattributes
.gitignore
.rspec
.travis.yml
CHANGES.md
CONTRIBUTING.md
Gemfile
LICENSE.md
README.md
Rakefile
VERSION
sixarm_ruby_password_hash-1.3.1.gem
sixarm_ruby_password_hash.gemspec

README.md

SixArm.com »Ruby »
PasswordHash class to generate secure SHA256 passwords

Introduction

Password hash tool to create secure passwords,

This uses SHA256 hexdigest for the cryptographic hash, and authenticates a password, salt, and hash.

For docs go to http://sixarm.com/sixarm_ruby_password_hash/doc

Want to help? We're happy to get pull requests.

Install

To install using a Gemfile, add this:

gem "sixarm_ruby_password_hash", ">= 1.3.1", "< 2"

To install using the command line, run this:

gem install sixarm_ruby_password_hash -v ">= 1.3.1, < 2"

To install using the command line with high security, run this:

wget http://sixarm.com/sixarm.pem
gem cert --add sixarm.pem && gem sources --add http://sixarm.com
gem install sixarm_ruby_password_hash -v ">= 1.3.1, < 2" --trust-policy HighSecurity

To require the gem in your code:

require "sixarm_ruby_password_hash"

Examples

To create a password:

require "sixarm_ruby_password_hash"
text = "mysecret"
salt = "azsxdcfv"
hash = PasswordHash.new(text,salt)

To create a password using our helpers:

require "sixarm_ruby_password_hash"
require "sixarm_ruby_password_salt"
require "sixarm_ruby_password_text"
text = PasswordText.new
salt = PasswordSalt.new
hash = PasswordHash.new(text,salt)

To verify a password:

hash.valid?(text,salt)

To verify a password from a web form for a user:

user = User.find(params[:id]) or raise "user not found"
user.hash.valid?(params[:password],user.salt)