No release in over 3 years
Low commit activity in last 3 years
PHC string format implemented by Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0
~> 3.0
 Project Readme

PhcStringFormat

Gem Version Build Status Known Vulnerabilities Codacy Badge Codacy Badge

PHC string format implemented by Ruby

Installation

Add this line to your application's Gemfile:

gem 'phc_string_format'

And then execute:

$ bundle

Or install it yourself as:

$ gem install phc_string_format

Usage

require 'phc_string_format'

encrypted_password = '$argon2i$v=19$m=4096,t=3,p=1$IfH5R3O3r3501DfGnGr2rw$DfQ8Hv9R2eF2uBs1dR99IGjVjDl/rpkJIkaNyZ1g3pk'

# parse
phc_string_args = PhcStringFormat::Formatter.parse(encrypted_password)
# => {:id=>"argon2i", :version=>19, :params=>{"m"=>4096, "t"=>3, "p"=>1}, :salt=>"!\xF1\xF9Gs\xB7\xAF~t\xD47\xC6\x9Cj\xF6\xAF", :hash=>"\r\xF4<\x1E\xFFQ\xD9\xE1v\xB8\e5u\x1F} h\xD5\x8C9\x7F\xAE\x99\t\"F\x8D\xC9\x9D`\xDE\x99"}

# format
password_hash = PhcStringFormat::Formatter.format(phc_string_args)

password_hash == encrypted_password

Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/naokikimura/phc_string_format.

License

The gem is available as open source under the terms of the MIT License.