grizzly_ber 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grizzly_ber.rb +18 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b796ad9d2b49d6498abc07485fbb2f66246e1e27
|
4
|
+
data.tar.gz: 59fcdec2acadfef81f5d4b84985c111837cd8fd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48ba2625b1a4c22763cc587736d59fdcf29c7f2df11bd9dc19a9cea775dd356070db281d83fcaa4b44897c3941b708b7ab13821716e2320635b610f2424d19a7
|
7
|
+
data.tar.gz: e39c7018a8b57fc5d1405d4d1cebb4fe3b4508b9b3b0c684046096b5367fb9065f49f6e2f67950ba4307b6bbe2a8ea6cf3ec5096e999227242c4daf8aa526800
|
data/lib/grizzly_ber.rb
CHANGED
@@ -35,6 +35,14 @@ class GrizzlyBer
|
|
35
35
|
decode_byte_array(binary_string.unpack("C*"))
|
36
36
|
end
|
37
37
|
|
38
|
+
def self.decode_all_hex(hex_string)
|
39
|
+
decode_all_binary([hex_string].pack("H*"))
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.decode_all_binary(binary_string)
|
43
|
+
decode_all_byte_array(binary_string.unpack("C*"))
|
44
|
+
end
|
45
|
+
|
38
46
|
def encode_hex
|
39
47
|
encoded = ""
|
40
48
|
encoded << @tag.to_s(16).upcase
|
@@ -47,6 +55,10 @@ class GrizzlyBer
|
|
47
55
|
encoded << encode_only_values
|
48
56
|
end
|
49
57
|
|
58
|
+
def encode_binary
|
59
|
+
[encode_hex].pack("H*")
|
60
|
+
end
|
61
|
+
|
50
62
|
def encode_only_values
|
51
63
|
if @value.is_a? String
|
52
64
|
@value.upcase
|
@@ -126,5 +138,11 @@ class GrizzlyBer
|
|
126
138
|
@value = byte_array.shift(@length).pack("C*").unpack("H*").first.upcase
|
127
139
|
end
|
128
140
|
end
|
141
|
+
|
142
|
+
def self.decode_all_byte_array(byte_array)
|
143
|
+
tlv_array = []
|
144
|
+
tlv_array << GrizzlyBer.new.instance_eval { decode_byte_array(byte_array) } while byte_array.size > 0
|
145
|
+
tlv_array
|
146
|
+
end
|
129
147
|
end
|
130
148
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grizzly_ber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Balsdon
|
@@ -27,12 +27,12 @@ require_paths:
|
|
27
27
|
- lib
|
28
28
|
required_ruby_version: !ruby/object:Gem::Requirement
|
29
29
|
requirements:
|
30
|
-
- -
|
30
|
+
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '0'
|
33
33
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
34
34
|
requirements:
|
35
|
-
- -
|
35
|
+
- - ">="
|
36
36
|
- !ruby/object:Gem::Version
|
37
37
|
version: '0'
|
38
38
|
requirements: []
|