digest-keccak 0.0.1 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +31 -23
- data/digest-keccak.gemspec +15 -7
- data/ext/digest/displayIntermediateValues.c +1 -1
- data/ext/digest/extconf.rb +26 -4
- data/lib/digest/keccak/version.rb +1 -1
- metadata +70 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b998ea8c0bcf37484e4b255506ab369cec069c8bef34e8849f5ac8ff108d3e7
|
4
|
+
data.tar.gz: 29f98ced535302da2b5f6b21ca14a3ce1762f53617cdfaacfef2c66fa438fcd5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e245c40644b1d94361c8e9beb3b332ca7f215f03deaabb3d64aa1b0e5fd60f4fb1b29a2d3b8a4e5092302de64faca8e05eced8b52a3dda49d54a2173bba8937
|
7
|
+
data.tar.gz: 3641c34fd37ecc0ba13449b4536c3c6f3facce3d14d2e718dc9b7674f13a0cf77e01438fcfe7233b8fa45e8774c22afc203aed6fff2c6fde9f90c4c6764e6811
|
data/README.md
CHANGED
@@ -8,6 +8,14 @@ is almost identical to that of the `digest` standard library.
|
|
8
8
|
|
9
9
|
|
10
10
|
|
11
|
+
Table of contents
|
12
|
+
-----------------
|
13
|
+
|
14
|
+
* [Usage](#usage)
|
15
|
+
* [Development](#development)
|
16
|
+
|
17
|
+
|
18
|
+
|
11
19
|
Usage
|
12
20
|
-----
|
13
21
|
|
@@ -16,37 +24,37 @@ and variable length. Variable length is not supported by this Ruby extension.
|
|
16
24
|
Unless the user specifies otherwise, this Ruby extension assumes 512-bit.
|
17
25
|
|
18
26
|
```ruby
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
27
|
+
require 'digest/keccak'
|
28
|
+
|
29
|
+
# Generate 512-bit digest.
|
30
|
+
Digest::Keccak.digest 'foo' #=> "\x15\x97\x84*\xACR\xBC\x9D..."
|
31
|
+
Digest::Keccak.hexdigest 'foo' #=> "1597842aac52bc9d..."
|
32
|
+
|
33
|
+
# Generate 224-bit digest.
|
34
|
+
Digest::Keccak.digest 'foo', 224 #=> "\xDA\xA9M\xA7\xF6\x80k\xF5..."
|
35
|
+
Digest::Keccak.hexdigest 'foo', 224 #=> "daa94da7f6806bf5..."
|
36
|
+
|
37
|
+
# Use this interface to feed data in chunks. 512-bit by default.
|
38
|
+
digest = Digest::Keccak.new
|
39
|
+
digest.update 'f'
|
40
|
+
digest.update 'o'
|
41
|
+
digest.update 'o'
|
42
|
+
digest.digest #=> "\x15\x97\x84*\xACR\xBC\x9D..."
|
43
|
+
digest.hexdigest #=> "1597842aac52bc9d..."
|
44
|
+
|
45
|
+
# You can pass a hash length to the constructor.
|
46
|
+
digest = Digest::Keccak.new 224
|
39
47
|
```
|
40
48
|
|
41
49
|
|
42
50
|
|
43
|
-
|
44
|
-
|
51
|
+
Development
|
52
|
+
-----------
|
45
53
|
|
46
54
|
Run the test suite as follows:
|
47
55
|
|
48
56
|
```
|
49
|
-
|
57
|
+
make test
|
50
58
|
```
|
51
59
|
|
52
60
|
A part of the test suite is automatically generated from Keccak's reference
|
data/digest-keccak.gemspec
CHANGED
@@ -9,23 +9,24 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.name = 'digest-keccak'
|
10
10
|
spec.version = Digest::Keccak::VERSION
|
11
11
|
spec.license = 'MIT'
|
12
|
-
spec.homepage = 'https://github.com/kotovalexarian/digest-keccak
|
12
|
+
spec.homepage = 'https://github.com/kotovalexarian/digest-keccak'
|
13
13
|
spec.summary = 'The Keccak cryptographic hash function.'
|
14
|
+
spec.platform = Gem::Platform::RUBY
|
14
15
|
|
15
|
-
spec.required_ruby_version = '
|
16
|
+
spec.required_ruby_version = '>= 2.2', '< 4'
|
16
17
|
|
17
|
-
spec.authors = ['Hongli Lai (Phusion)', 'Keccak authors']
|
18
|
-
spec.email = %w[
|
18
|
+
spec.authors = ['Alex Kotov', 'Hongli Lai (Phusion)', 'Keccak authors']
|
19
|
+
spec.email = %w[kotovalexarian@gmail.com]
|
19
20
|
|
20
21
|
spec.description = <<-DESCRIPTION.split.join ' '
|
21
22
|
The Keccak (draft version of SHA-3) cryptographic hash function.
|
22
23
|
DESCRIPTION
|
23
24
|
|
24
25
|
spec.metadata = {
|
25
|
-
'homepage_uri' => 'https://github.com/kotovalexarian/digest-keccak
|
26
|
-
'source_code_uri' => 'https://github.com/kotovalexarian/digest-keccak
|
26
|
+
'homepage_uri' => 'https://github.com/kotovalexarian/digest-keccak',
|
27
|
+
'source_code_uri' => 'https://github.com/kotovalexarian/digest-keccak',
|
27
28
|
'bug_tracker_uri' =>
|
28
|
-
'https://github.com/kotovalexarian/digest-keccak
|
29
|
+
'https://github.com/kotovalexarian/digest-keccak/issues',
|
29
30
|
}.freeze
|
30
31
|
|
31
32
|
spec.bindir = 'exe'
|
@@ -40,7 +41,14 @@ Gem::Specification.new do |spec|
|
|
40
41
|
'lib/**/*',
|
41
42
|
]
|
42
43
|
|
44
|
+
spec.test_files = spec.files.grep %r{^(test|spec|features)/}
|
45
|
+
|
43
46
|
spec.executables = spec.files.grep %r{^exe/}, &File.method(:basename)
|
44
47
|
|
45
48
|
spec.extensions << 'ext/digest/extconf.rb'
|
49
|
+
|
50
|
+
spec.add_development_dependency 'bundler', '~> 2.2'
|
51
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
52
|
+
spec.add_development_dependency 'rubocop', '~> 1.7'
|
53
|
+
spec.add_development_dependency 'rubocop-performance', '~> 1.9'
|
46
54
|
end
|
@@ -110,7 +110,7 @@ void displayRoundNumber(int level, unsigned int i)
|
|
110
110
|
void displayText(int level, const char *text)
|
111
111
|
{
|
112
112
|
if ((intermediateValueFile) && (level <= displayLevel)) {
|
113
|
-
fprintf(intermediateValueFile, text);
|
113
|
+
fprintf(intermediateValueFile, "%s", text);
|
114
114
|
fprintf(intermediateValueFile, "\n");
|
115
115
|
fprintf(intermediateValueFile, "\n");
|
116
116
|
}
|
data/ext/digest/extconf.rb
CHANGED
@@ -1,9 +1,31 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
1
2
|
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'mkmf'
|
4
5
|
|
5
|
-
|
6
|
-
|
6
|
+
def cflags(*args)
|
7
|
+
args.each do |str|
|
8
|
+
$CFLAGS += " #{str.shellescape} "
|
9
|
+
end
|
10
|
+
end
|
7
11
|
|
8
|
-
|
9
|
-
|
12
|
+
def have_header!(*args)
|
13
|
+
exit 1 unless have_header(*args)
|
14
|
+
end
|
15
|
+
|
16
|
+
def have_func!(header, *args)
|
17
|
+
exit 1 unless have_func(*args, header)
|
18
|
+
end
|
19
|
+
|
20
|
+
cflags '-std=c11'
|
21
|
+
cflags '-Wall'
|
22
|
+
cflags '-Wextra'
|
23
|
+
cflags '-fvisibility=hidden'
|
24
|
+
|
25
|
+
have_header! 'ruby/digest.h'
|
26
|
+
have_header! 'stdio.h'
|
27
|
+
have_header! 'string.h'
|
28
|
+
|
29
|
+
have_func! 'rb_str_set_len'
|
30
|
+
|
31
|
+
create_makefile 'digest/keccak' or exit 1
|
metadata
CHANGED
@@ -1,19 +1,76 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digest-keccak
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Alex Kotov
|
7
8
|
- Hongli Lai (Phusion)
|
8
9
|
- Keccak authors
|
9
10
|
autorequire:
|
10
11
|
bindir: exe
|
11
12
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
13
|
+
date: 2021-09-15 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: bundler
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.2'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '2.2'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: rake
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '13.0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '13.0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: rubocop
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '1.7'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.7'
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: rubocop-performance
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.9'
|
64
|
+
type: :development
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.9'
|
14
71
|
description: The Keccak (draft version of SHA-3) cryptographic hash function.
|
15
72
|
email:
|
16
|
-
-
|
73
|
+
- kotovalexarian@gmail.com
|
17
74
|
executables: []
|
18
75
|
extensions:
|
19
76
|
- ext/digest/extconf.rb
|
@@ -36,29 +93,32 @@ files:
|
|
36
93
|
- ext/digest/extconf.rb
|
37
94
|
- ext/digest/keccak.c
|
38
95
|
- lib/digest/keccak/version.rb
|
39
|
-
homepage: https://github.com/kotovalexarian/digest-keccak
|
96
|
+
homepage: https://github.com/kotovalexarian/digest-keccak
|
40
97
|
licenses:
|
41
98
|
- MIT
|
42
99
|
metadata:
|
43
|
-
homepage_uri: https://github.com/kotovalexarian/digest-keccak
|
44
|
-
source_code_uri: https://github.com/kotovalexarian/digest-keccak
|
45
|
-
bug_tracker_uri: https://github.com/kotovalexarian/digest-keccak
|
100
|
+
homepage_uri: https://github.com/kotovalexarian/digest-keccak
|
101
|
+
source_code_uri: https://github.com/kotovalexarian/digest-keccak
|
102
|
+
bug_tracker_uri: https://github.com/kotovalexarian/digest-keccak/issues
|
46
103
|
post_install_message:
|
47
104
|
rdoc_options: []
|
48
105
|
require_paths:
|
49
106
|
- lib
|
50
107
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
108
|
requirements:
|
52
|
-
- - "
|
109
|
+
- - ">="
|
53
110
|
- !ruby/object:Gem::Version
|
54
111
|
version: '2.2'
|
112
|
+
- - "<"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '4'
|
55
115
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
116
|
requirements:
|
57
117
|
- - ">="
|
58
118
|
- !ruby/object:Gem::Version
|
59
119
|
version: '0'
|
60
120
|
requirements: []
|
61
|
-
rubygems_version: 3.
|
121
|
+
rubygems_version: 3.2.22
|
62
122
|
signing_key:
|
63
123
|
specification_version: 4
|
64
124
|
summary: The Keccak cryptographic hash function.
|