sha3 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of sha3 might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/Gemfile.ci +7 -1
- data/README.rdoc +7 -8
- data/ext/sha3/digest.c +24 -24
- data/ext/sha3/digest.h +4 -4
- data/lib/sha3/version.rb +1 -1
- metadata +18 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 436b7ffcabd2a9189627fae92670969c380bcb32
|
4
|
+
data.tar.gz: 8acf1e3317cd25aed84682f3c00859ac9bd77def
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1a9de0610411fca06486af4f447d8ea965726dc7e00bca1ae1ca9548c65156d34505c6aca06307a5bfec353fccad0ded756b2f446e01fbfcb57b45a25d722525
|
7
|
+
data.tar.gz: 992efbc3bf525432faabde2c4ecc30435cc49718e76a7a5e9c27766f61bc3e5cf507535f42fc5efcfe3ec89d30491c4e1909a53092a58c98a0756afc868a95db
|
data/.travis.yml
CHANGED
data/Gemfile.ci
CHANGED
data/README.rdoc
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
= sha3 {<img src="https://secure.travis-ci.org/johanns/sha3.png" alt="Build Status" />}[http://travis-ci.org/johanns/sha3] {<img src="https://gemnasium.com/johanns/sha3.png" alt="Dependency Status" />}[https://gemnasium.com/johanns/sha3]
|
1
|
+
= sha3 {<img src="https://badge.fury.io/rb/sha3.png" alt="Gem Version" />}[http://badge.fury.io/rb/sha3] {<img src="https://secure.travis-ci.org/johanns/sha3.png" alt="Build Status" />}[http://travis-ci.org/johanns/sha3] {<img src="https://gemnasium.com/johanns/sha3.png" alt="Dependency Status" />}[https://gemnasium.com/johanns/sha3] {<img src="https://codeclimate.com/github/johanns/sha3.png" />}[https://codeclimate.com/github/johanns/sha3]
|
2
2
|
|
3
3
|
<em>SHA3 for Ruby</em> is a native (C) implementation of Keccak (SHA3) cryptographic hashing algorithm.
|
4
4
|
|
@@ -58,7 +58,7 @@ Alternatively, you can instantiate using one of four sub-classes:
|
|
58
58
|
|
59
59
|
### Digest class-methods: ###
|
60
60
|
|
61
|
-
SHA3::Digest.hexdigest("Hash me, please"
|
61
|
+
SHA3::Digest.hexdigest(:sha224, "Hash me, please")
|
62
62
|
# => "200e7bc18cd613..."
|
63
63
|
|
64
64
|
SHA3::Digest::SHA384.digest("Hash me, please")
|
@@ -96,20 +96,19 @@ Only a small subset of test vectors are included in the source repository; howev
|
|
96
96
|
|
97
97
|
Tested with Rubies:
|
98
98
|
|
99
|
+
- MRI 2.1.0
|
99
100
|
- MRI 2.0.0
|
100
101
|
- MRI 1.9.3
|
101
102
|
- MRI 1.9.2
|
102
103
|
- MRI 1.8.7
|
103
104
|
- MRI Ruby-Head
|
104
|
-
- Rubinius
|
105
|
-
- Rubinius (19mode)
|
106
|
-
- ree
|
105
|
+
- Rubinius 2
|
107
106
|
|
108
107
|
On:
|
109
108
|
|
110
109
|
- Ubuntu 12.04, 12.10, 13.04
|
111
|
-
- Windows 7, 8
|
112
|
-
- Mac OS X 10.
|
110
|
+
- Windows 7, 8, 8.1
|
111
|
+
- Mac OS X 10.6 - 10.9
|
113
112
|
|
114
113
|
== Releases
|
115
114
|
|
@@ -127,6 +126,6 @@ On:
|
|
127
126
|
|
128
127
|
== Copyright
|
129
128
|
|
130
|
-
Copyright (c) 2012 -
|
129
|
+
Copyright (c) 2012 - 2014 Johanns Gregorian (https://github.com/johanns)
|
131
130
|
|
132
131
|
See LICENSE.txt for details.
|
data/ext/sha3/digest.c
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
#include "sha3.h"
|
4
4
|
|
5
|
-
VALUE
|
6
|
-
VALUE
|
5
|
+
VALUE cSHA3Digest;
|
6
|
+
VALUE eSHA3DigestError;
|
7
7
|
|
8
8
|
/*
|
9
9
|
* == Notes
|
@@ -38,12 +38,12 @@ static VALUE c_digest_alloc(VALUE klass)
|
|
38
38
|
|
39
39
|
mdx = (MDX *) malloc(sizeof(MDX));
|
40
40
|
if (!mdx)
|
41
|
-
rb_raise(
|
41
|
+
rb_raise(eSHA3DigestError, "failed to allocate object memory");
|
42
42
|
|
43
43
|
mdx->state = (hashState *) malloc(sizeof(hashState));
|
44
44
|
if (!mdx->state) {
|
45
45
|
free_allox(mdx);
|
46
|
-
rb_raise(
|
46
|
+
rb_raise(eSHA3DigestError, "failed to allocate state memory");
|
47
47
|
}
|
48
48
|
|
49
49
|
obj = Data_Wrap_Struct(klass, 0, free_allox, mdx);
|
@@ -71,7 +71,7 @@ static VALUE c_digest_init(int argc, VALUE *argv, VALUE self)
|
|
71
71
|
mdx->hashbitlen = 256;
|
72
72
|
|
73
73
|
if (Init(mdx->state, mdx->hashbitlen) != SUCCESS)
|
74
|
-
rb_raise(
|
74
|
+
rb_raise(eSHA3DigestError, "failed to initialize algorithm state");
|
75
75
|
|
76
76
|
if (!NIL_P(data))
|
77
77
|
return c_digest_update(self, data);
|
@@ -91,7 +91,7 @@ static VALUE c_digest_update(VALUE self, VALUE data)
|
|
91
91
|
dlen = (RSTRING_LEN(data) * 8);
|
92
92
|
|
93
93
|
if (Update(mdx->state, RSTRING_PTR(data), dlen) != SUCCESS)
|
94
|
-
rb_raise(
|
94
|
+
rb_raise(eSHA3DigestError, "failed to update hash data");
|
95
95
|
|
96
96
|
return self;
|
97
97
|
}
|
@@ -106,7 +106,7 @@ static VALUE c_digest_reset(VALUE self)
|
|
106
106
|
memset(mdx->state, 0, sizeof(hashState));
|
107
107
|
|
108
108
|
if (Init(mdx->state, mdx->hashbitlen) != SUCCESS)
|
109
|
-
rb_raise(
|
109
|
+
rb_raise(eSHA3DigestError, "failed to reset internal state");
|
110
110
|
|
111
111
|
return self;
|
112
112
|
}
|
@@ -147,7 +147,7 @@ static VALUE c_digest_copy(VALUE self, VALUE obj)
|
|
147
147
|
GETMDX(self, mdx1);
|
148
148
|
SAFEGETMDX(obj, mdx2);
|
149
149
|
if (!cmp_states(mdx1, mdx2))
|
150
|
-
rb_raise(
|
150
|
+
rb_raise(eSHA3DigestError, "failed to copy state");
|
151
151
|
|
152
152
|
return self;
|
153
153
|
}
|
@@ -194,7 +194,7 @@ static VALUE c_digest_finish(int argc, VALUE *argv, VALUE self)
|
|
194
194
|
}
|
195
195
|
|
196
196
|
if (Final(mdx->state, RSTRING_PTR(str)) != SUCCESS)
|
197
|
-
rb_raise(
|
197
|
+
rb_raise(eSHA3DigestError, "failed to finalize digest");
|
198
198
|
|
199
199
|
return str;
|
200
200
|
}
|
@@ -221,7 +221,7 @@ static VALUE c_digest_compute(int argc, VALUE *argv, VALUE self)
|
|
221
221
|
str = rb_str_new(0, hashbitlen / 8);
|
222
222
|
|
223
223
|
if (Hash(hashbitlen, RSTRING_PTR(data), datalen, RSTRING_PTR(str)) != SUCCESS)
|
224
|
-
rb_raise(
|
224
|
+
rb_raise(eSHA3DigestError, "failed to generate hash");
|
225
225
|
|
226
226
|
return str;
|
227
227
|
}
|
@@ -231,25 +231,25 @@ void Init_sha3_n_digest()
|
|
231
231
|
rb_require("digest");
|
232
232
|
|
233
233
|
/* SHA3::Digest (class) */
|
234
|
-
|
234
|
+
cSHA3Digest = rb_define_class_under(mSHA3, "Digest", rb_path2class("Digest::Class"));
|
235
235
|
/* SHA3::Digest::DigestError (class) */
|
236
|
-
|
236
|
+
eSHA3DigestError = rb_define_class_under(cSHA3Digest, "DigestError", rb_eStandardError);
|
237
237
|
|
238
238
|
// SHA3::Digest (class) methods
|
239
|
-
rb_define_alloc_func(
|
240
|
-
rb_define_method(
|
241
|
-
rb_define_method(
|
242
|
-
rb_define_method(
|
243
|
-
rb_define_method(
|
244
|
-
rb_define_method(
|
245
|
-
rb_define_method(
|
246
|
-
rb_define_method(
|
247
|
-
rb_define_private_method(
|
248
|
-
|
249
|
-
rb_define_alias(
|
239
|
+
rb_define_alloc_func(cSHA3Digest, c_digest_alloc);
|
240
|
+
rb_define_method(cSHA3Digest, "initialize", c_digest_init, -1);
|
241
|
+
rb_define_method(cSHA3Digest, "update", c_digest_update, 1);
|
242
|
+
rb_define_method(cSHA3Digest, "reset", c_digest_reset, 0);
|
243
|
+
rb_define_method(cSHA3Digest, "initialize_copy", c_digest_copy, 1);
|
244
|
+
rb_define_method(cSHA3Digest, "digest_length", c_digest_length, 0);
|
245
|
+
rb_define_method(cSHA3Digest, "block_length", c_digest_block_length, 0);
|
246
|
+
rb_define_method(cSHA3Digest, "name", c_digest_name, 0);
|
247
|
+
rb_define_private_method(cSHA3Digest, "finish", c_digest_finish, -1);
|
248
|
+
|
249
|
+
rb_define_alias(cSHA3Digest, "<<", "update");
|
250
250
|
|
251
251
|
// SHA3 (module) functions (support bit operations)
|
252
|
-
rb_define_singleton_method(
|
252
|
+
rb_define_singleton_method(cSHA3Digest, "compute", c_digest_compute, -1);
|
253
253
|
|
254
254
|
return;
|
255
255
|
}
|
data/ext/sha3/digest.h
CHANGED
@@ -16,15 +16,15 @@ extern "C" {
|
|
16
16
|
} while (0)
|
17
17
|
|
18
18
|
#define SAFEGETMDX(obj, mdx) do { \
|
19
|
-
if (!rb_obj_is_kind_of(obj,
|
19
|
+
if (!rb_obj_is_kind_of(obj, cSHA3Digest)) { \
|
20
20
|
rb_raise(rb_eTypeError, "wrong argument (%s)! (expected %s)",\
|
21
|
-
rb_obj_classname(obj), rb_class2name(
|
21
|
+
rb_obj_classname(obj), rb_class2name(cSHA3Digest)); \
|
22
22
|
} \
|
23
23
|
GETMDX(obj, mdx); \
|
24
24
|
} while(0)
|
25
25
|
|
26
|
-
extern VALUE
|
27
|
-
extern VALUE
|
26
|
+
extern VALUE cSHA3Digest;
|
27
|
+
extern VALUE eSHA3DigestError;
|
28
28
|
|
29
29
|
typedef struct {
|
30
30
|
hashState *state;
|
data/lib/sha3/version.rb
CHANGED
metadata
CHANGED
@@ -1,69 +1,69 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sha3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Johanns Gregorian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-06-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '2.4'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '2.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubygems-tasks
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0.2'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - ~>
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0.2'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: yard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.8'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.8'
|
69
69
|
description: SHA3 for Ruby is a native (C) implementation of Keccak (SHA3) cryptographic
|
@@ -74,11 +74,11 @@ extensions:
|
|
74
74
|
- ext/sha3/extconf.rb
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
-
- .document
|
78
|
-
- .gitignore
|
79
|
-
- .rspec
|
80
|
-
- .travis.yml
|
81
|
-
- .yardopts
|
77
|
+
- ".document"
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rspec"
|
80
|
+
- ".travis.yml"
|
81
|
+
- ".yardopts"
|
82
82
|
- ChangeLog.rdoc
|
83
83
|
- Gemfile
|
84
84
|
- Gemfile.ci
|
@@ -131,17 +131,17 @@ require_paths:
|
|
131
131
|
- lib
|
132
132
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
133
|
requirements:
|
134
|
-
- -
|
134
|
+
- - ">="
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0'
|
137
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
138
|
requirements:
|
139
|
-
- -
|
139
|
+
- - ">="
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
143
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.
|
144
|
+
rubygems_version: 2.4.5
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: SHA3 for Ruby
|