lightning-onion 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lightning/onion/packet.rb +8 -6
- data/lib/lightning/onion/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c6806de17849e69c6989e9ee721d72f5b65970c
|
4
|
+
data.tar.gz: cda740daf5f7ed956b53c0c9dce39469ac717b71
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe55f5943e8f57bb3a14119978ea98ff1dcc377e4fc94ea2d8bcd4faa5660fae1b26b0a7044e8a2c2e61bdc45000e469a1c27593d772f1b00838b417cc7ae169
|
7
|
+
data.tar.gz: 3e0e1834d0f26fef6b0e8403e2d3627c2aef2e57b98aaad74db73b3de8acc00b98f12c2d7f5c50324818acb1c83978717a2379d36a10c8c88295ac1a393d14b7
|
@@ -3,22 +3,24 @@
|
|
3
3
|
module Lightning
|
4
4
|
module Onion
|
5
5
|
class Packet
|
6
|
-
include Lightning::Onion::Sphinx
|
7
|
-
|
8
6
|
attr_accessor :version, :public_key, :routing_info, :hmac
|
9
7
|
|
10
8
|
def initialize(version, public_key, routing_info, hmac)
|
11
9
|
@version = version
|
12
10
|
@public_key = public_key
|
13
11
|
@routing_info = routing_info
|
14
|
-
raise "invalid size #{routing_info.size}" unless routing_info.size ==
|
12
|
+
raise "invalid size #{routing_info.size}" unless routing_info.size == Packet.routing_bytesize * 2
|
15
13
|
@hmac = hmac
|
16
14
|
end
|
17
15
|
|
16
|
+
def self.routing_bytesize
|
17
|
+
Lightning::Onion::Sphinx::MAX_HOPS * Lightning::Onion::Sphinx::HOP_LENGTH
|
18
|
+
end
|
19
|
+
|
18
20
|
def self.parse(payload)
|
19
21
|
version, public_key, rest = payload.unpack('aH66a*')
|
20
|
-
routing_info = rest[0...
|
21
|
-
hmac = rest[
|
22
|
+
routing_info = rest[0...routing_bytesize].bth
|
23
|
+
hmac = rest[routing_bytesize..-1].bth
|
22
24
|
new(version, public_key, routing_info, hmac)
|
23
25
|
end
|
24
26
|
|
@@ -31,7 +33,7 @@ module Lightning
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def last?
|
34
|
-
hmac ==
|
36
|
+
hmac == '00' * 32
|
35
37
|
end
|
36
38
|
end
|
37
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lightning-onion
|
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
|
- Hajime Yamaguchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: algebrick
|