digest-kangarootwelve 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -2
- data/ext/digest/kangarootwelve/ext.c +44 -29
- data/ext/digest/kangarootwelve/extconf.rb +2 -0
- data/ext/digest/kangarootwelve/utils.h +5 -3
- data/lib/digest/kangarootwelve/version.rb +1 -1
- data/test/test.rb +42 -42
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe63a409aef358036b2c298c06de28e0a6916bfa283f02303b58d9fcab607af1
|
4
|
+
data.tar.gz: d2ab330b5ede162c6bbea6616b451608927535ce01ecd95dc532c415dc1bfa00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95c04bb572011f47a793f5c25529c99f742fb7d2b9c074c79f639b09dd259ea17ce3faa3485115e95049f5bf07e36a44ae8c5756cb00ae0befbc65d99fa572b9
|
7
|
+
data.tar.gz: f5a553b015a3fc000a401eb7cd6679dba463373e046d45bf60470ed60a9484faf1ca72e1ba80afd21900eac69e461b5f92539a130548e514032a0b74ee5103af
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# digest-kangarootwelve
|
1
|
+
# digest-kangarootwelve
|
2
2
|
|
3
3
|
The digest-kangarootwelve gem is an implementation of KangarooTwelve for Ruby
|
4
4
|
that works on top of `Digest::Base`.
|
@@ -114,4 +114,5 @@ https://rubygems.org/gems/digest-kangarootwelve
|
|
114
114
|
5. Create a new Pull Request.
|
115
115
|
|
116
116
|
[![Build Status](https://travis-ci.org/konsolebox/digest-kangarootwelve-ruby.svg?branch=master)](https://travis-ci.org/konsolebox/digest-kangarootwelve-ruby)
|
117
|
-
[![Build
|
117
|
+
[![Build Status](https://ci.appveyor.com/api/projects/status/bwedifhi4wa5wik7?svg=true)](https://ci.appveyor.com/project/konsolebox/digest-kangarootwelve-ruby)
|
118
|
+
[![Build Status](https://github.com/konsolebox/digest-kangarootwelve-ruby/actions/workflows/ruby.yml/badge.svg)](https://github.com/konsolebox/digest-kangarootwelve-ruby/actions/workflows/ruby.yml)
|
@@ -71,6 +71,8 @@ typedef struct {
|
|
71
71
|
#define KT_CONTEXT kangarootwelve_context_t
|
72
72
|
#define KT_CONTEXT_PTR(void_ctx_ptr) ((KT_CONTEXT *) void_ctx_ptr)
|
73
73
|
|
74
|
+
#define _RSTRING_PTR_U(x) (unsigned char *)RSTRING_PTR(x)
|
75
|
+
|
74
76
|
static void check_digest_length(int digest_length)
|
75
77
|
{
|
76
78
|
if (!(digest_length >= KT_MIN_DIGEST_LENGTH))
|
@@ -79,18 +81,24 @@ static void check_digest_length(int digest_length)
|
|
79
81
|
|
80
82
|
static VALUE hex_encode_str(VALUE str)
|
81
83
|
{
|
82
|
-
int len
|
83
|
-
VALUE hex
|
84
|
-
|
84
|
+
int len;
|
85
|
+
VALUE hex;
|
86
|
+
|
87
|
+
len = RSTRING_LEN(str);
|
88
|
+
hex = rb_str_new(0, len * 2);
|
89
|
+
hex_encode_str_implied(_RSTRING_PTR_U(str), len, _RSTRING_PTR_U(hex));
|
85
90
|
return hex;
|
86
91
|
}
|
87
92
|
|
88
93
|
static VALUE hex_decode_str(VALUE str)
|
89
94
|
{
|
90
|
-
int len
|
91
|
-
VALUE decoded
|
95
|
+
int len;
|
96
|
+
VALUE decoded;
|
92
97
|
|
93
|
-
|
98
|
+
len = RSTRING_LEN(str);
|
99
|
+
decoded = rb_str_new(0, calc_hex_decoded_str_length(len));
|
100
|
+
|
101
|
+
if (! hex_decode_str_implied(_RSTRING_PTR_U(str), len, _RSTRING_PTR_U(decoded))) {
|
94
102
|
VALUE inspect = rb_inspect(str);
|
95
103
|
rb_raise(rb_eArgError, "Failed to decode hex string %s.", RSTRING_PTR(inspect));
|
96
104
|
}
|
@@ -100,24 +108,26 @@ static VALUE hex_decode_str(VALUE str)
|
|
100
108
|
|
101
109
|
static int kangarootwelve_init(void *ctx)
|
102
110
|
{
|
111
|
+
VALUE klass_or_instance, digest_length, digest_length_int, customization;
|
112
|
+
|
103
113
|
if (ctx == NULL)
|
104
114
|
rb_raise(rb_eRuntimeError, "Context pointer is NULL.");
|
105
115
|
|
106
|
-
|
116
|
+
klass_or_instance = rb_current_receiver();
|
107
117
|
|
108
118
|
if (TYPE(klass_or_instance) == T_CLASS && klass_or_instance == _Digest_KangarooTwelve_Impl)
|
109
119
|
rb_raise(rb_eStandardError, "Digest::KangarooTwelve::Impl is a base class and cannot be instantiated.");
|
110
120
|
|
111
|
-
|
121
|
+
digest_length = rb_funcall(klass_or_instance, _id_digest_length, 0);
|
112
122
|
|
113
123
|
if (TYPE(digest_length) != T_FIXNUM)
|
114
124
|
rb_raise(rb_eTypeError, "Invalid object type for digest length.");
|
115
125
|
|
116
|
-
|
126
|
+
digest_length_int = FIX2INT(digest_length);
|
117
127
|
|
118
128
|
check_digest_length(digest_length_int);
|
119
129
|
|
120
|
-
|
130
|
+
customization = rb_funcall(klass_or_instance, _id_customization, 0);
|
121
131
|
|
122
132
|
if (TYPE(customization) != T_NIL && TYPE(customization) != T_STRING)
|
123
133
|
rb_raise(rb_eTypeError, "Invalid object type for a customization string.");
|
@@ -144,17 +154,19 @@ static void kangarootwelve_update(void *ctx, unsigned char *data, size_t length)
|
|
144
154
|
|
145
155
|
static int kangarootwelve_finish(void *ctx, unsigned char *data)
|
146
156
|
{
|
157
|
+
VALUE customization;
|
158
|
+
|
147
159
|
if (ctx == NULL)
|
148
160
|
rb_raise(rb_eRuntimeError, "Context pointer is NULL.");
|
149
161
|
|
150
|
-
|
162
|
+
customization = KT_CONTEXT_PTR(ctx)->customization;
|
151
163
|
|
152
164
|
switch (TYPE(customization)) {
|
153
165
|
case T_NIL:
|
154
166
|
return KangarooTwelve_Final(&KT_CONTEXT_PTR(ctx)->instance, data, 0, 0) == 0;
|
155
167
|
case T_STRING:
|
156
|
-
return KangarooTwelve_Final(&KT_CONTEXT_PTR(ctx)->instance, data,
|
157
|
-
RSTRING_LEN(customization)) == 0;
|
168
|
+
return KangarooTwelve_Final(&KT_CONTEXT_PTR(ctx)->instance, data,
|
169
|
+
_RSTRING_PTR_U(customization), RSTRING_LEN(customization)) == 0;
|
158
170
|
default:
|
159
171
|
rb_raise(rb_eRuntimeError, "Object type of customization string became invalid.");
|
160
172
|
}
|
@@ -162,11 +174,14 @@ static int kangarootwelve_finish(void *ctx, unsigned char *data)
|
|
162
174
|
|
163
175
|
static VALUE implement(VALUE name, VALUE digest_length, VALUE customization)
|
164
176
|
{
|
177
|
+
VALUE impl_class, impl_class_name, prev_digest_length, metadata_obj;
|
178
|
+
ID impl_class_name_id, id;
|
179
|
+
int digest_length_int, prev_digest_length_int;
|
180
|
+
rb_digest_metadata_t *metadata;
|
181
|
+
|
165
182
|
if (!KT_DIGEST_API_VERSION_IS_SUPPORTED(RUBY_DIGEST_API_VERSION))
|
166
183
|
rb_raise(rb_eRuntimeError, "Digest API version is not supported.");
|
167
184
|
|
168
|
-
int digest_length_int;
|
169
|
-
|
170
185
|
switch (TYPE(digest_length)) {
|
171
186
|
case T_NIL:
|
172
187
|
digest_length_int = KT_DEFAULT_DIGEST_LENGTH;
|
@@ -187,8 +202,7 @@ static VALUE implement(VALUE name, VALUE digest_length, VALUE customization)
|
|
187
202
|
rb_raise(rb_eTypeError, "Invalid value type for customization string.");
|
188
203
|
}
|
189
204
|
|
190
|
-
|
191
|
-
ID impl_class_name_id, id;
|
205
|
+
impl_class_name = Qnil;
|
192
206
|
|
193
207
|
switch (TYPE(name)) {
|
194
208
|
case T_NIL:
|
@@ -223,8 +237,6 @@ static VALUE implement(VALUE name, VALUE digest_length, VALUE customization)
|
|
223
237
|
rb_raise(rb_eTypeError, "Invalid argument type for class name.");
|
224
238
|
}
|
225
239
|
|
226
|
-
VALUE impl_class;
|
227
|
-
|
228
240
|
if (impl_class_name == Qnil) {
|
229
241
|
impl_class = rb_funcall(rb_cClass, _id_new, 1, _Digest_KangarooTwelve_Impl);
|
230
242
|
} else {
|
@@ -243,7 +255,7 @@ static VALUE implement(VALUE name, VALUE digest_length, VALUE customization)
|
|
243
255
|
StringValueCStr(impl_class_name));
|
244
256
|
}
|
245
257
|
|
246
|
-
|
258
|
+
prev_digest_length = rb_ivar_get(impl_class, _id_digest_length);
|
247
259
|
|
248
260
|
if (TYPE(prev_digest_length) != T_FIXNUM) {
|
249
261
|
rb_raise(rb_eRuntimeError,
|
@@ -251,7 +263,7 @@ static VALUE implement(VALUE name, VALUE digest_length, VALUE customization)
|
|
251
263
|
StringValueCStr(impl_class_name));
|
252
264
|
}
|
253
265
|
|
254
|
-
|
266
|
+
prev_digest_length_int = FIX2INT(prev_digest_length);
|
255
267
|
|
256
268
|
if (prev_digest_length_int != digest_length_int) {
|
257
269
|
rb_raise(rb_eTypeError,
|
@@ -267,8 +279,6 @@ static VALUE implement(VALUE name, VALUE digest_length, VALUE customization)
|
|
267
279
|
impl_class = rb_define_class_id_under(_Digest, impl_class_name_id, _Digest_KangarooTwelve_Impl);
|
268
280
|
}
|
269
281
|
|
270
|
-
VALUE metadata_obj;
|
271
|
-
rb_digest_metadata_t *metadata;
|
272
282
|
metadata_obj = Data_Make_Struct(_Digest_KangarooTwelve_Metadata, rb_digest_metadata_t, 0, -1, metadata);
|
273
283
|
|
274
284
|
metadata->api_version = RUBY_DIGEST_API_VERSION;
|
@@ -560,17 +570,22 @@ static VALUE _Digest_KangarooTwelve_Impl_customization_hex(VALUE self)
|
|
560
570
|
*/
|
561
571
|
static VALUE _Digest_KangarooTwelve_Impl_inspect(VALUE self)
|
562
572
|
{
|
563
|
-
VALUE klass
|
564
|
-
|
573
|
+
VALUE klass, klass_name, digest_length, customization_hex, hexdigest, args[4];
|
574
|
+
|
575
|
+
klass = rb_obj_class(self);
|
576
|
+
klass_name = rb_class_name(klass);
|
565
577
|
|
566
578
|
if (klass_name == Qnil)
|
567
579
|
klass_name = rb_inspect(klass);
|
568
580
|
|
569
|
-
|
570
|
-
|
571
|
-
|
581
|
+
digest_length = rb_funcall(self, _id_digest_length, 0);
|
582
|
+
customization_hex = rb_funcall(self, _id_customization_hex, 0);
|
583
|
+
hexdigest = rb_funcall(self, _id_hexdigest, 0);
|
572
584
|
|
573
|
-
|
585
|
+
args[0] = klass_name;
|
586
|
+
args[1] = digest_length;
|
587
|
+
args[2] = customization_hex;
|
588
|
+
args[3] = hexdigest;
|
574
589
|
return rb_str_format(sizeof(args), args, rb_str_new_literal("#<%s:%d|%s|%s>"));
|
575
590
|
}
|
576
591
|
|
@@ -11,4 +11,6 @@ common_dir = File.join(File.dirname(__FILE__), 'keccak', 'common')
|
|
11
11
|
target_dir = File.join(File.dirname(__FILE__), 'keccak', target)
|
12
12
|
find_header('align.h', common_dir)
|
13
13
|
find_header('KeccakP-1600-SnP.h', target_dir)
|
14
|
+
$defs.push('-Wall') if enable_config('all-warnings')
|
14
15
|
create_makefile('digest/kangarootwelve', target_dir)
|
16
|
+
File.write('Makefile', 'V = 1', mode: 'a') if enable_config('verbose-mode')
|
@@ -34,8 +34,10 @@ static void hex_encode_str_implied(const unsigned char *src, size_t len, unsigne
|
|
34
34
|
*/
|
35
35
|
static int hex_decode_str_implied(const unsigned char *src, size_t len, unsigned char *dest)
|
36
36
|
{
|
37
|
+
unsigned char low, high;
|
38
|
+
|
37
39
|
if (len % 2) {
|
38
|
-
|
40
|
+
low = *src++;
|
39
41
|
|
40
42
|
if (low >= '0' && low <= '9') {
|
41
43
|
low -= '0';
|
@@ -52,7 +54,7 @@ static int hex_decode_str_implied(const unsigned char *src, size_t len, unsigned
|
|
52
54
|
}
|
53
55
|
|
54
56
|
for (; len > 0; len -= 2) {
|
55
|
-
|
57
|
+
high = *src++;
|
56
58
|
|
57
59
|
if (high >= '0' && high <= '9') {
|
58
60
|
high -= '0';
|
@@ -64,7 +66,7 @@ static int hex_decode_str_implied(const unsigned char *src, size_t len, unsigned
|
|
64
66
|
return 0;
|
65
67
|
}
|
66
68
|
|
67
|
-
|
69
|
+
low = *src++;
|
68
70
|
|
69
71
|
if (low >= '0' && low <= '9') {
|
70
72
|
low -= '0';
|
data/test/test.rb
CHANGED
@@ -22,48 +22,48 @@ end
|
|
22
22
|
|
23
23
|
describe Digest::KangarooTwelve do
|
24
24
|
it "produces implementation classes" do
|
25
|
-
Digest::KangarooTwelve[32].superclass.must_equal Digest::KangarooTwelve::Impl
|
26
|
-
Digest::KangarooTwelve[32].digest_length.must_equal 32
|
27
|
-
Digest::KangarooTwelve[32].must_equal Digest::KangarooTwelve_32
|
28
|
-
Digest::KangarooTwelve.implement(digest_length: 64).superclass.must_equal Digest::KangarooTwelve::Impl
|
29
|
-
Digest::KangarooTwelve.implement(digest_length: 64).digest_length.must_equal 64
|
30
|
-
Digest::KangarooTwelve.implement(digest_length: 64).must_equal Digest::KangarooTwelve_64
|
25
|
+
_(Digest::KangarooTwelve[32].superclass).must_equal Digest::KangarooTwelve::Impl
|
26
|
+
_(Digest::KangarooTwelve[32].digest_length).must_equal 32
|
27
|
+
_(Digest::KangarooTwelve[32]).must_equal Digest::KangarooTwelve_32
|
28
|
+
_(Digest::KangarooTwelve.implement(digest_length: 64).superclass).must_equal Digest::KangarooTwelve::Impl
|
29
|
+
_(Digest::KangarooTwelve.implement(digest_length: 64).digest_length).must_equal 64
|
30
|
+
_(Digest::KangarooTwelve.implement(digest_length: 64)).must_equal Digest::KangarooTwelve_64
|
31
31
|
end
|
32
32
|
|
33
33
|
it "produces a default implemention with a digest length of 64" do
|
34
|
-
Digest::KangarooTwelve.implement.must_equal Digest::KangarooTwelve_64
|
35
|
-
Digest::KangarooTwelve_64.digest_length.must_equal 64
|
34
|
+
_(Digest::KangarooTwelve.implement).must_equal Digest::KangarooTwelve_64
|
35
|
+
_(Digest::KangarooTwelve_64.digest_length).must_equal 64
|
36
36
|
end
|
37
37
|
|
38
38
|
it "produces instances that are consistent with produced implementation classes" do
|
39
|
-
Digest::KangarooTwelve[32].new.class.must_equal Digest::KangarooTwelve_32
|
40
|
-
Digest::KangarooTwelve.implement(digest_length: 48).must_equal Digest::KangarooTwelve_48
|
39
|
+
_(Digest::KangarooTwelve[32].new.class).must_equal Digest::KangarooTwelve_32
|
40
|
+
_(Digest::KangarooTwelve.implement(digest_length: 48)).must_equal Digest::KangarooTwelve_48
|
41
41
|
end
|
42
42
|
|
43
43
|
it "produces classes with equal digest length as its instances" do
|
44
|
-
Digest::KangarooTwelve[32].new.digest_length.must_equal Digest::KangarooTwelve_32.digest_length
|
45
|
-
Digest::KangarooTwelve.implement(digest_length: 48).new.digest_length.must_equal Digest::KangarooTwelve_48.digest_length
|
44
|
+
_(Digest::KangarooTwelve[32].new.digest_length).must_equal Digest::KangarooTwelve_32.digest_length
|
45
|
+
_(Digest::KangarooTwelve.implement(digest_length: 48).new.digest_length).must_equal Digest::KangarooTwelve_48.digest_length
|
46
46
|
end
|
47
47
|
|
48
48
|
it "produces hashes" do
|
49
|
-
Digest::KangarooTwelve.default.digest("").class.must_equal String
|
50
|
-
Digest::KangarooTwelve.default.hexdigest("").class.must_equal String
|
51
|
-
Digest::KangarooTwelve.default.new.digest("").class.must_equal String
|
52
|
-
Digest::KangarooTwelve.default.new.hexdigest("").class.must_equal String
|
49
|
+
_(Digest::KangarooTwelve.default.digest("").class).must_equal String
|
50
|
+
_(Digest::KangarooTwelve.default.hexdigest("").class).must_equal String
|
51
|
+
_(Digest::KangarooTwelve.default.new.digest("").class).must_equal String
|
52
|
+
_(Digest::KangarooTwelve.default.new.hexdigest("").class).must_equal String
|
53
53
|
end
|
54
54
|
|
55
55
|
it "produces similar output with its digest and hexdigest methods" do
|
56
56
|
digest_a = Digest::KangarooTwelve[32].digest("abcd")
|
57
|
-
digest_a.class.must_equal String
|
57
|
+
_(digest_a.class).must_equal String
|
58
58
|
digest_b = Digest::KangarooTwelve[32].new.digest("abcd")
|
59
|
-
digest_b.class.must_equal String
|
60
|
-
digest_a.must_equal digest_b
|
59
|
+
_(digest_b.class).must_equal String
|
60
|
+
_(digest_a).must_equal digest_b
|
61
61
|
hex_digest_a = Digest::KangarooTwelve[32].hexdigest("abcd")
|
62
|
-
hex_digest_a.class.must_equal String
|
62
|
+
_(hex_digest_a.class).must_equal String
|
63
63
|
hex_digest_b = Digest::KangarooTwelve[32].new.hexdigest("abcd")
|
64
|
-
hex_digest_b.class.must_equal String
|
65
|
-
hex_digest_a.must_equal hex_digest_b
|
66
|
-
hex_digest_a.must_equal hex_encode(digest_a)
|
64
|
+
_(hex_digest_b.class).must_equal String
|
65
|
+
_(hex_digest_a).must_equal hex_digest_b
|
66
|
+
_(hex_digest_a).must_equal hex_encode(digest_a)
|
67
67
|
end
|
68
68
|
|
69
69
|
it "works with customization strings" do
|
@@ -75,38 +75,38 @@ describe Digest::KangarooTwelve do
|
|
75
75
|
b = Digest::KangarooTwelve.implement(name: "KangarooTwelveTestB", digest_length: 48, customization: "abcd")
|
76
76
|
c = Digest::KangarooTwelve.implement(name: "KangarooTwelveTestC", digest_length: 48, customization_hex: "61626364")
|
77
77
|
d = Digest::KangarooTwelve.implement(name: "KangarooTwelveTestD", digest_length: 48, ch: "61626364")
|
78
|
-
a.name.must_equal "Digest::KangarooTwelveTestA"
|
79
|
-
b.name.must_equal "Digest::KangarooTwelveTestB"
|
80
|
-
a.digest_length.must_equal 48
|
81
|
-
b.digest_length.must_equal a.digest_length
|
82
|
-
a.customization.must_equal "abcd"
|
83
|
-
b.customization.must_equal a.customization
|
84
|
-
c.customization.must_equal a.customization
|
85
|
-
d.customization.must_equal a.customization
|
78
|
+
_(a.name).must_equal "Digest::KangarooTwelveTestA"
|
79
|
+
_(b.name).must_equal "Digest::KangarooTwelveTestB"
|
80
|
+
_(a.digest_length).must_equal 48
|
81
|
+
_(b.digest_length).must_equal a.digest_length
|
82
|
+
_(a.customization).must_equal "abcd"
|
83
|
+
_(b.customization).must_equal a.customization
|
84
|
+
_(c.customization).must_equal a.customization
|
85
|
+
_(d.customization).must_equal a.customization
|
86
86
|
end
|
87
87
|
|
88
88
|
it "has a customization method that returns nil when customization string is undefined" do
|
89
|
-
Digest::KangarooTwelve.implement.customization.must_be_nil
|
89
|
+
_(Digest::KangarooTwelve.implement.customization).must_be_nil
|
90
90
|
end
|
91
91
|
|
92
92
|
it "has a customization_hex method that returns hex of customization string, or nil" do
|
93
|
-
Digest::KangarooTwelve.implement(c: "abcd").customization_hex.must_equal "61626364"
|
94
|
-
Digest::KangarooTwelve.implement.customization_hex.must_be_nil
|
93
|
+
_(Digest::KangarooTwelve.implement(c: "abcd").customization_hex).must_equal "61626364"
|
94
|
+
_(Digest::KangarooTwelve.implement.customization_hex).must_be_nil
|
95
95
|
end
|
96
96
|
|
97
97
|
it "has a declared block length of 8192 bytes" do
|
98
|
-
Digest::KangarooTwelve::BLOCK_LENGTH.must_equal 8192
|
99
|
-
Digest::KangarooTwelve.default.block_length.must_equal 8192
|
100
|
-
Digest::KangarooTwelve.default.new.block_length.must_equal 8192
|
98
|
+
_(Digest::KangarooTwelve::BLOCK_LENGTH).must_equal 8192
|
99
|
+
_(Digest::KangarooTwelve.default.block_length).must_equal 8192
|
100
|
+
_(Digest::KangarooTwelve.default.new.block_length).must_equal 8192
|
101
101
|
end
|
102
102
|
|
103
103
|
it "produces valid hashes" do
|
104
104
|
# KangarooTwelve(M=empty, C=empty, 32 bytes):
|
105
|
-
Digest::KangarooTwelve[32].new.hexdigest("").must_equal "1ac2d450fc3b4205d19da7bfca1b37513c0803577ac7167f06fe2ce1f0ef39e5"
|
105
|
+
_(Digest::KangarooTwelve[32].new.hexdigest("")).must_equal "1ac2d450fc3b4205d19da7bfca1b37513c0803577ac7167f06fe2ce1f0ef39e5"
|
106
106
|
# KangarooTwelve(M=empty, C=empty, 64 bytes):
|
107
|
-
Digest::KangarooTwelve[64].new.hexdigest("").must_equal "1ac2d450fc3b4205d19da7bfca1b37513c0803577ac7167f06fe2ce1f0ef39e54269c056b8c82e48276038b6d292966cc07a3d4645272e31ff38508139eb0a71"
|
107
|
+
_(Digest::KangarooTwelve[64].new.hexdigest("")).must_equal "1ac2d450fc3b4205d19da7bfca1b37513c0803577ac7167f06fe2ce1f0ef39e54269c056b8c82e48276038b6d292966cc07a3d4645272e31ff38508139eb0a71"
|
108
108
|
# KangarooTwelve(M=empty, C=empty, 10032 bytes), last 32 bytes:
|
109
|
-
Digest::KangarooTwelve[10032].new.hexdigest("")[-64..-1].must_equal "e8dc563642f7228c84684c898405d3a834799158c079b12880277a1d28e2ff6d"
|
109
|
+
_(Digest::KangarooTwelve[10032].new.hexdigest("")[-64..-1]).must_equal "e8dc563642f7228c84684c898405d3a834799158c079b12880277a1d28e2ff6d"
|
110
110
|
|
111
111
|
# KangarooTwelve(M=pattern 0x00 to 0xFA for 17^i bytes, C=empty, 32 bytes):
|
112
112
|
[
|
@@ -119,7 +119,7 @@ describe Digest::KangarooTwelve do
|
|
119
119
|
[6, "3c390782a8a4e89fa6367f72feaaf13255c8d95878481d3cd8ce85f58e880af8"]
|
120
120
|
].each do |i, hash|
|
121
121
|
m = get_repeated_0x00_to_0xfa(17 ** i)
|
122
|
-
Digest::KangarooTwelve[32].new.hexdigest(m).must_equal hash
|
122
|
+
_(Digest::KangarooTwelve[32].new.hexdigest(m)).must_equal hash
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
@@ -133,7 +133,7 @@ describe Digest::KangarooTwelve do
|
|
133
133
|
].each do |i, j, hash|
|
134
134
|
m = get_repeated_0xff(i)
|
135
135
|
c = get_repeated_0x00_to_0xfa(41 ** j)
|
136
|
-
Digest::KangarooTwelve.implement(digest_length: 32, customization: c).new.hexdigest(m).must_equal hash
|
136
|
+
_(Digest::KangarooTwelve.implement(digest_length: 32, customization: c).new.hexdigest(m)).must_equal hash
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: digest-kangarootwelve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- konsolebox
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -371,7 +371,7 @@ homepage: https://github.com/konsolebox/digest-kangarootwelve-ruby
|
|
371
371
|
licenses:
|
372
372
|
- MIT
|
373
373
|
metadata: {}
|
374
|
-
post_install_message:
|
374
|
+
post_install_message:
|
375
375
|
rdoc_options: []
|
376
376
|
require_paths:
|
377
377
|
- lib
|
@@ -386,9 +386,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
386
386
|
- !ruby/object:Gem::Version
|
387
387
|
version: '0'
|
388
388
|
requirements: []
|
389
|
-
|
390
|
-
|
391
|
-
signing_key:
|
389
|
+
rubygems_version: 3.2.14
|
390
|
+
signing_key:
|
392
391
|
specification_version: 4
|
393
392
|
summary: KangarooTwelve for Ruby
|
394
393
|
test_files:
|