Add documentation and license

This commit is contained in:
Hongli Lai (Phusion) 2012-10-05 12:30:09 +02:00
parent a9ef3176ac
commit 255d6ad9f1
3 changed files with 44 additions and 1 deletions

9
LICENSE Normal file
View File

@ -0,0 +1,9 @@
Copyright (c) 2012 Phusion
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This package contains code written by the Keccak authors, which is licensed http://creativecommons.org/publicdomain/zero/1.0/

32
README.md Normal file
View File

@ -0,0 +1,32 @@
# The SHA-3 (Keccak) extension for Ruby
This Ruby extension implements the SHA-3 (Keccak) 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.
## Installation
gem install digest-sha3
## 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.
require 'digest/sha3'
# Generate 512-bit digest.
Digest::SHA3.digest("foo") # => "\025\227\204*..."
Digest::SHA3.hexdigest("foo") # => "1597842a..."
# Generate 224-bit digest.
Digest::SHA3.digest("foo", 224) # => "\332\251M\247..."
Digest::SHA3.hexdigest("foo", 224) # => "daa94da7..."
# Use this interface to feed data in chunks. 512-bit by default.
digest = Digest::SHA3.new
digest.update("f")
digest.update("o")
digest.update("o")
digest.digest # => "\025\227\204*..."
digest.hexdigest # => "1597842a..."
# You can pass a hash length to the constructor.
digest = Digest::SHA3.new(224)

View File

@ -5,12 +5,14 @@ Gem::Specification.new do |s|
s.version = Digest::SHA3::Version::STRING
s.summary = "The SHA-3 (Keccak) hash"
s.email = "hongli@phusion.nl"
s.homepage = "https://github.com/phusion/digest-sha3"
s.homepage = "https://github.com/phusion/digest-sha3-ruby"
s.description = "The SHA-3 (Keccak) hash."
s.authors = ["Hongli Lai", "Keccak authors"]
s.extensions << "ext/digest/extconf.rb"
s.files = Dir[
"README.md",
"LICENSE",
"digest-sha3.gemspec",
"ext/**/*.{c,h,rb}",
"lib/**/*"