hexify 0.2 → 0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hexify.rb +15 -2
- 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: 295d63a1673bc856ce8965ec47393232a9b26172
|
4
|
+
data.tar.gz: d596a87ca82684d9aa6cdf33f1cd2b46423b98bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fde065908e3dc1dfcb7156d88a6be3be4b6473c9a4591982a60afd0eba0eaa2e0cd5d2937f91e028fc2a8e58c73c29c212299c70327cf5a376763838aaafb8c6
|
7
|
+
data.tar.gz: 0b9a2cc6926599bb8c4e1d4b765f8e572b9c05f669281721b9df56481a9b658b8e22197a614a9d66f6c68d54ccb7148c0cd640e39df6bf781ffc26aac7cb5bf9
|
data/lib/hexify.rb
CHANGED
@@ -1,7 +1,20 @@
|
|
1
1
|
class Hexify
|
2
2
|
|
3
|
-
def self.
|
4
|
-
|
3
|
+
def self.listing(data, options={})
|
4
|
+
text = " "
|
5
|
+
raw(data).each_with_index do |byte, i|
|
6
|
+
if i != 0 and i%16 == 0
|
7
|
+
puts text # takes care of \n
|
8
|
+
text = " "
|
9
|
+
end
|
10
|
+
print "%08x: " % [i] if i == 0 or i%16 == 0
|
11
|
+
print "#{byte} "
|
12
|
+
text += "%s" % [ byte.hex.chr.gsub(/[^[:print:]]/,'.') ]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.raw(data)
|
17
|
+
data.bytes.each.inject([]) { |output, byte| output << "%02x" % [byte.ord] }
|
5
18
|
end
|
6
19
|
|
7
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hexify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.3'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrzej Dyjak
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Turning data blobs into hex, one dump at a time.
|
14
14
|
email: dyjakan@gmail.com
|