diff --git a/README.md b/README.md index 36eec7c..2137157 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,23 @@ -# The SHA-3 (Keccak) extension for Ruby +Digest::Keccak +============== -This Ruby extension implements the SHA-3 ([Keccak](http://keccak.noekeon.org/)) cryptographic hashing algorithm. It is based on the reference C implementation, version 3.2. The exposed interface is almost identical to that of the `digest` standard library. +This Ruby extension implements the [Keccak](http://keccak.noekeon.org/) +(draft version of SHA-3) cryptographic hash function. It is based on +the reference C implementation, version 3.2. The exposed interface +is almost identical to that of the `digest` standard library. [](http://www.phusion.nl/) -## Installation - gem install digest-sha3 -**Note**: as of version 1.1.0, digest-sha3 requires Ruby 2.2. The last version that worked on older versions was 1.0.2. +Usage +----- -## Usage - -Keccak supports 5 hash lengths: 224-bit, 256-bit, 384-bit, 512-bit and variable length. Variable length is not supported by this Ruby extension. Unless the user specifies otherwise, this Ruby extension assumes 512-bit. +Keccak supports 5 hash lengths: 224-bit, 256-bit, 384-bit, 512-bit +and variable length. Variable length is not supported by this Ruby extension. +Unless the user specifies otherwise, this Ruby extension assumes 512-bit. +```ruby require 'digest/sha3' # Generate 512-bit digest. @@ -34,19 +38,18 @@ Keccak supports 5 hash lengths: 224-bit, 256-bit, 384-bit, 512-bit and variable # You can pass a hash length to the constructor. digest = Digest::SHA3.new(224) +``` -## Running the test suite + + +Running the test suite +---------------------- Run the test suite as follows: +``` make test +``` -A part of the test suite is automatically generated from Keccak's reference test suite. - -## Warning - -Do not use SHA-3 for hashing passwords. Do not even use SHA-3 + salt for hashing passowords. Use a [slow hash](http://codahale.com/how-to-safely-store-a-password/) instead. - -## See also - -[node-sha3](https://github.com/phusion/node-sha3) +A part of the test suite is automatically generated from Keccak's reference +test suite. diff --git a/digest-sha3.gemspec b/digest-sha3.gemspec index 44bc042..3691d15 100644 --- a/digest-sha3.gemspec +++ b/digest-sha3.gemspec @@ -1,23 +1,46 @@ -require File.expand_path('lib/digest/sha3/version') +# frozen_string_literal: true -Gem::Specification.new do |s| - s.name = "digest-sha3" - s.version = Digest::SHA3::Version::STRING - s.summary = "The SHA-3 (Keccak) hash" - s.email = "software-signing@phusion.nl" - s.homepage = "https://github.com/phusion/digest-sha3-ruby" - s.description = "The SHA-3 (Keccak) hash." - s.authors = ["Hongli Lai (Phusion)", "Keccak authors"] - s.extensions << "ext/digest/extconf.rb" - s.required_ruby_version = "~> 2.2" - s.license = "MIT" +lib = File.expand_path('lib', __dir__).freeze +$LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib - s.files = Dir[ - "README.md", - "LICENSE", - "Makefile", - "digest-sha3.gemspec", - "ext/**/*.{c,h,rb}", - "lib/**/*" +require 'digest/sha3/version' + +Gem::Specification.new do |spec| + spec.name = 'digest-sha3' + spec.version = Digest::SHA3::Version::STRING + spec.license = 'MIT' + spec.homepage = 'https://github.com/kotovalexarian/digest-keccak.rb' + spec.summary = 'The Keccak cryptographic hash function.' + + spec.required_ruby_version = '~> 2.2' + + spec.authors = ['Hongli Lai (Phusion)', 'Keccak authors'] + spec.email = %w[software-signing@phusion.nl] + + spec.description = <<-DESCRIPTION.split.join ' ' + The Keccak (draft version of SHA-3) cryptographic hash function. + DESCRIPTION + + spec.metadata = { + 'homepage_uri' => 'https://github.com/kotovalexarian/digest-keccak.rb', + 'source_code_uri' => 'https://github.com/kotovalexarian/digest-keccak.rb', + 'bug_tracker_uri' => + 'https://github.com/kotovalexarian/digest-keccak.rb/issues', + }.freeze + + spec.bindir = 'exe' + spec.require_paths = ['lib'] + + spec.files = Dir[ + 'README.md', + 'LICENSE', + 'Makefile', + 'digest-sha3.gemspec', + 'ext/**/*.{c,h,rb}', + 'lib/**/*', ] + + spec.executables = spec.files.grep %r{^exe/}, &File.method(:basename) + + spec.extensions << 'ext/digest/extconf.rb' end