Some fixes
This commit is contained in:
parent
0a49f96525
commit
cd172e45d2
2 changed files with 63 additions and 37 deletions
39
README.md
39
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.
|
||||||
|
|
||||||
[<img src="http://www.phusion.nl/assets/logo.png">](http://www.phusion.nl/)
|
[<img src="http://www.phusion.nl/assets/logo.png">](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.
|
||||||
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.
|
Unless the user specifies otherwise, this Ruby extension assumes 512-bit.
|
||||||
|
|
||||||
|
```ruby
|
||||||
require 'digest/sha3'
|
require 'digest/sha3'
|
||||||
|
|
||||||
# Generate 512-bit digest.
|
# 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.
|
# You can pass a hash length to the constructor.
|
||||||
digest = Digest::SHA3.new(224)
|
digest = Digest::SHA3.new(224)
|
||||||
|
```
|
||||||
|
|
||||||
## Running the test suite
|
|
||||||
|
|
||||||
|
Running the test suite
|
||||||
|
----------------------
|
||||||
|
|
||||||
Run the test suite as follows:
|
Run the test suite as follows:
|
||||||
|
|
||||||
|
```
|
||||||
make test
|
make test
|
||||||
|
```
|
||||||
|
|
||||||
A part of the test suite is automatically generated from Keccak's reference test suite.
|
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)
|
|
||||||
|
|
|
@ -1,23 +1,46 @@
|
||||||
require File.expand_path('lib/digest/sha3/version')
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
lib = File.expand_path('lib', __dir__).freeze
|
||||||
s.name = "digest-sha3"
|
$LOAD_PATH.unshift lib unless $LOAD_PATH.include? lib
|
||||||
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"
|
|
||||||
|
|
||||||
s.files = Dir[
|
require 'digest/sha3/version'
|
||||||
"README.md",
|
|
||||||
"LICENSE",
|
Gem::Specification.new do |spec|
|
||||||
"Makefile",
|
spec.name = 'digest-sha3'
|
||||||
"digest-sha3.gemspec",
|
spec.version = Digest::SHA3::Version::STRING
|
||||||
"ext/**/*.{c,h,rb}",
|
spec.license = 'MIT'
|
||||||
"lib/**/*"
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue