An open API service indexing awesome lists of open source software.

https://github.com/sixarm/sixarm_ruby_password_hash

SixArm.com » Ruby » Password Hash to do secure SHA256 passwords.
https://github.com/sixarm/sixarm_ruby_password_hash

authentication gem password ruby security

Last synced: over 1 year ago
JSON representation

SixArm.com » Ruby » Password Hash to do secure SHA256 passwords.

Awesome Lists containing this project

README

          

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

* Doc:
* Gem:
* Repo:

## 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

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

## Install

### Gem

To install this gem in your shell or terminal:

gem install sixarm_ruby_password_hash

### Gemfile

To add this gem to your Gemfile:

gem 'sixarm_ruby_password_hash'

### Require

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)