Update references to lib name

This commit is contained in:
Mauricio Gomes 2018-05-29 21:45:40 -04:00
parent 3f65e51cac
commit bb7aca509a
3 changed files with 9 additions and 10 deletions

View file

@ -25,11 +25,11 @@ require 'blake2b'
input = 'abc'
# The main application of keyed BLAKE2 is as a message authentication code (MAC)
# By default `Blake2::Key.none` is used.
# By default `Blake2b::Key.none` is used.
key = Blake2b::Key.none
# key = Blake2::Key.from_string("foo bar baz")
# key = Blake2::Key.from_hex('DEADBEAF')
# key = Blake2::Key.from_bytes([222, 173, 190, 175])
# key = Blake2b::Key.from_string("foo bar baz")
# key = Blake2b::Key.from_hex('DEADBEAF')
# key = Blake2b::Key.from_bytes([222, 173, 190, 175])
# The output length in Bytes of the Hash, Max and Default is 32.
out_len = 32

View file

@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
spec.description = "A cryptographic hash function faster than MD5, SHA-1, SHA-2, and SHA-3 for 64-bit systems."
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
spec.extensions << "ext/blake2_ext/extconf.rb"
spec.extensions << "ext/blake2b_ext/extconf.rb"
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
@ -20,6 +20,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "rake-compiler", "~> 0.9"
spec.add_development_dependency "bundler" , "~> 1.5"
spec.add_development_dependency "rake" , "~> 11.1"
spec.add_development_dependency "minitest" , "~> 5.8"
spec.add_development_dependency "pry" , "~> 0.10"
spec.add_development_dependency "minitest" , "~> 5.11"
end

View file

@ -2,12 +2,12 @@ require 'blake2b_ext'
require 'blake2b/key'
class Blake2b
def self.hex(input, key = Blake2::Key.none, out_len = 32)
def self.hex(input, key = Blake2b::Key.none, out_len = 32)
check_if_valid!(input, key, out_len)
Blake2b.new(out_len, key).digest(input, :to_hex)
end
def self.bytes(input, key = Blake2::Key.none, out_len = 32)
def self.bytes(input, key = Blake2b::Key.none, out_len = 32)
check_if_valid!(input, key, out_len)
Blake2b.new(out_len, key).digest(input, :to_bytes)
end
@ -17,7 +17,7 @@ class Blake2b
raise ArgumentError, 'input arg must be a String'
end
unless key.is_a?(Blake2::Key)
unless key.is_a?(Blake2b::Key)
raise ArgumentError, 'key arg must be a Blake2b::Key'
end