noise-ruby 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/noise/functions/dh/secp256k1.rb +5 -1
- data/lib/noise/functions/hash/blake2s.rb +6 -18
- data/lib/noise/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52f9bedd93319f9cf54acb51c1a83c64fcfd25cfdaef69204f709b59c83060c4
|
4
|
+
data.tar.gz: c72fb7afa8aab1c577b305f1d57316ab34ad183b6bbf249d420b3b17d4bb81e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be31e461a923db0af2f6ae19b42fa74ac3b70fcac8e332a281a46377ac0fa0164ce799567ba19e862fbbc40b367b06672bd095ea850bcd4bfaec2291b1b4ab16
|
7
|
+
data.tar.gz: e3495a893d23263a534d7f490fdcd84a5f33c81b4e5d8437d1a268abc8111940916ecf6f832f2b13bf610d5ec9f1059129c16a9f2a0728a823b96a147482e7ac
|
@@ -62,7 +62,7 @@ module Noise
|
|
62
62
|
raise ArgumentError if out_len == 0 || out_len > 32
|
63
63
|
h = IV.dup
|
64
64
|
h[0] ^= 0x01010000 ^ (key.size << 8) ^ out_len
|
65
|
-
t =
|
65
|
+
t = 0
|
66
66
|
c = 0
|
67
67
|
b = Array.new(Blake2s::BLOCKLEN).fill(0, key.size)
|
68
68
|
ctx = Context.new(b, h, t, c, out_len)
|
@@ -76,12 +76,7 @@ module Noise
|
|
76
76
|
def update_internal(ctx, input)
|
77
77
|
input.size.times do |i|
|
78
78
|
if ctx.c == Blake2s::BLOCKLEN
|
79
|
-
ctx.t
|
80
|
-
# if ctx.t[0] < ctx.c
|
81
|
-
if ctx.t[0] > 0xFFFFFFFF
|
82
|
-
ctx.t[0] = ctx.t[0] - 0xFFFFFFFF
|
83
|
-
ctx.t[1] += 1
|
84
|
-
end
|
79
|
+
ctx.t += ctx.c
|
85
80
|
compress(ctx, false)
|
86
81
|
ctx.c = 0
|
87
82
|
end
|
@@ -92,12 +87,7 @@ module Noise
|
|
92
87
|
end
|
93
88
|
|
94
89
|
def final(ctx, out)
|
95
|
-
ctx.t
|
96
|
-
if ctx.t[0] > 0xFFFFFFFF
|
97
|
-
ctx.t[0] = ctx.t[0] - 0xFFFFFFFF
|
98
|
-
ctx.t[1] += 1
|
99
|
-
end
|
100
|
-
|
90
|
+
ctx.t += ctx.c
|
101
91
|
while ctx.c < Blake2s::BLOCKLEN
|
102
92
|
ctx.b[ctx.c] = 0
|
103
93
|
ctx.c += 1
|
@@ -151,12 +141,10 @@ module Noise
|
|
151
141
|
v[i + 8] = IV[i]
|
152
142
|
end
|
153
143
|
|
154
|
-
v[12] ^= ctx.t
|
155
|
-
v[13] ^= ctx.t
|
144
|
+
v[12] ^= ctx.t & 0xFFFFFFFF
|
145
|
+
v[13] ^= (ctx.t / 0x100000000) & 0xFFFFFFFF
|
156
146
|
|
157
|
-
|
158
|
-
v[14] = ~v[14] & 0xFFFFFFFF
|
159
|
-
end
|
147
|
+
v[14] = (last ? ~v[14] : v[14]) & 0xFFFFFFFF
|
160
148
|
|
161
149
|
16.times do |i|
|
162
150
|
m[i] = get32(ctx.b[4 * i], ctx.b[4 * i + 1], ctx.b[4 * i + 2], ctx.b[4 * i + 3])
|
data/lib/noise/version.rb
CHANGED