hash-ber-tlv 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. data/lib/hash-ber-tlv.rb +4 -3
  2. metadata +3 -3
data/lib/hash-ber-tlv.rb CHANGED
@@ -19,10 +19,11 @@ class Hash
19
19
  else
20
20
  num_octets = length & 0x7f
21
21
  octets = data[tag.length + 1, num_octets].unpack('C*')
22
+
22
23
  length = 0
23
- octets.each_with_index do |octet, idx|
24
- length += octet * 255 ** (num_octets - idx - 1)
25
- end
24
+ octets.reverse.each_with_index {|octet, idx|
25
+ length += octet * (256**idx)
26
+ }
26
27
 
27
28
  self[tag_i] = data[tag.length + 1 + num_octets, length]
28
29
  remainder = data[tag.length + 1 + num_octets + length..-1]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 1
9
- version: 1.0.1
8
+ - 2
9
+ version: 1.0.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Maxim Chechel
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2012-10-22 00:00:00 +04:00
17
+ date: 2012-11-22 00:00:00 +04:00
18
18
  default_executable:
19
19
  dependencies: []
20
20