hexdump 0.3.0 → 1.0.0

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 (52) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog.md +68 -2
  3. data/Gemfile +1 -0
  4. data/README.md +486 -135
  5. data/benchmark.rb +29 -22
  6. data/lib/hexdump/chars.rb +46 -0
  7. data/lib/hexdump/core_ext/file.rb +68 -6
  8. data/lib/hexdump/core_ext/io.rb +2 -2
  9. data/lib/hexdump/core_ext/kernel.rb +7 -0
  10. data/lib/hexdump/core_ext/string.rb +2 -2
  11. data/lib/hexdump/core_ext/string_io.rb +2 -2
  12. data/lib/hexdump/core_ext.rb +1 -0
  13. data/lib/hexdump/format_string.rb +43 -0
  14. data/lib/hexdump/hexdump.rb +768 -75
  15. data/lib/hexdump/mixin.rb +198 -0
  16. data/lib/hexdump/module_methods.rb +132 -0
  17. data/lib/hexdump/numeric/binary.rb +55 -0
  18. data/lib/hexdump/numeric/char_or_int.rb +90 -0
  19. data/lib/hexdump/numeric/decimal.rb +56 -0
  20. data/lib/hexdump/numeric/exceptions.rb +11 -0
  21. data/lib/hexdump/numeric/hexadecimal.rb +59 -0
  22. data/lib/hexdump/numeric/octal.rb +55 -0
  23. data/lib/hexdump/numeric.rb +5 -0
  24. data/lib/hexdump/reader.rb +314 -0
  25. data/lib/hexdump/theme/ansi.rb +81 -0
  26. data/lib/hexdump/theme/rule.rb +159 -0
  27. data/lib/hexdump/theme.rb +61 -0
  28. data/lib/hexdump/type.rb +232 -0
  29. data/lib/hexdump/types.rb +108 -0
  30. data/lib/hexdump/version.rb +1 -1
  31. data/lib/hexdump.rb +12 -1
  32. data/spec/chars_spec.rb +76 -0
  33. data/spec/core_ext_spec.rb +10 -6
  34. data/spec/hexdump_class_spec.rb +1708 -0
  35. data/spec/hexdump_module_spec.rb +23 -0
  36. data/spec/mixin_spec.rb +37 -0
  37. data/spec/numeric/binary_spec.rb +239 -0
  38. data/spec/numeric/char_or_int_spec.rb +210 -0
  39. data/spec/numeric/decimal_spec.rb +317 -0
  40. data/spec/numeric/hexadecimal_spec.rb +320 -0
  41. data/spec/numeric/octal_spec.rb +239 -0
  42. data/spec/reader_spec.rb +863 -0
  43. data/spec/theme/ansi_spec.rb +242 -0
  44. data/spec/theme/rule_spec.rb +199 -0
  45. data/spec/theme_spec.rb +94 -0
  46. data/spec/type_spec.rb +317 -0
  47. data/spec/types_spec.rb +904 -0
  48. metadata +39 -10
  49. data/.gemtest +0 -0
  50. data/lib/hexdump/dumper.rb +0 -419
  51. data/spec/dumper_spec.rb +0 -329
  52. data/spec/hexdump_spec.rb +0 -30
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc17566453285686c384ffb48945dfa526b3d4ea24a3edec8b193540ec40fead
4
- data.tar.gz: cfd9d433a9d11d85b43cd98a46e4b8c1aa67dcc572bd0ebfd7771469bbc315ed
3
+ metadata.gz: 6c7d2cd541f81ae5ed4191d544eac913e7e9b2f55fad23320fedb00ce6b02eb2
4
+ data.tar.gz: 6c12dd82076f8b2bf1272ad47f9e509c6f0553642c9ad2079eeab38bca3dad36
5
5
  SHA512:
6
- metadata.gz: bcc397a847ff0d4b9cfef884d6c8c97ed344cbded5242cfeccd2e6e61dc755a4dfb3ac20ddfc65d66f1428dce3ba36ab46858c9c2fdb2e43905b73c4f39e0c10
7
- data.tar.gz: 3917cbf496621c7ddd8e9aec840be04b1836145f082fa0eefe016438cba570cda39013becd7a07fefdb8e4a0c1e9a13b17690f238da468ed528792c043e1c1f4
6
+ metadata.gz: cf2a9fc5999b94a8ad91b5bcef2a001a66e1e2f9e177b37c7e256df6775b708d84e061b0024428f3c6a0834d42f148d714f0e200a923b64f979761d500f60088
7
+ data.tar.gz: 7044bdfd16ff11ac1cb38b9d1f9d28faf61d147d1f5f2932e37e018479de77c194e587e39342a45103c6c4acc2128f09463d1b56f44637f99e850103c07a7c87
data/ChangeLog.md CHANGED
@@ -1,3 +1,69 @@
1
+ ### 1.0.0 / 2021-08-31
2
+
3
+ * Added the ability to hexdump typed data. Available `type:`s are :
4
+ * `:char` - signed 8bit ASCII character
5
+ * `:uchar` - unsigned 8bit ASCII character
6
+ * `:int8` - signed 8bit integer
7
+ * `:uin8` / `:byte` - unsigned 8bit integer (default)
8
+ * `:int16` / `:short` - signed 16bit integer
9
+ * `:int16_le` / `:short_le` - signed 16bit integer (little endian)
10
+ * `:int16_be` / `:short_be` - signed 16bit integer (big endian)
11
+ * `:int16_ne` / `:short_ne` - signed 16bit integer (network endian)
12
+ * `:uint16` / `:ushort` - unsigned 16bit integer
13
+ * `:uint16_le` / `:ushort_le` - unsigned 16bit integer (little endian)
14
+ * `:uint16_be` / `:ushort_be` - unsigned 16bit integer (big endian)
15
+ * `:uint16_ne` / `:ushort_ne` - unsigned 16bit integer (network endian)
16
+ * `:int32` / `:int` / `:long` - signed 32bit integer
17
+ * `:int32_le` / `:int_le` / `:long_le` - signed 32bit integer (little endian)
18
+ * `:int32_be` / `:int_be` / `:long_be` - signed 32bit integer (big endian)
19
+ * `:int32_ne` / `:int_ne` / `:long_ne` - signed 32bit integer (network endian)
20
+ * `:uint32` / `:uint` / `:ulong` - unsigned 32bit integer
21
+ * `:uint32_le` / `:uint_le` / `:ulong_le` - unsigned 32bit integer (little endian)
22
+ * `:uint32_be` / `:uint_be` / `:ulong_be` - unsigned 32bit integer (big endian)
23
+ * `:uint32_ne` / `:uint_ne` / `:ulong_ne` - unsigned 32bit integer (network endian)
24
+ * `:int64` / `:long_long` - signed 64bit integer
25
+ * `:int64_le` / `:long_long_le` - signed 64bit integer (little endian)
26
+ * `:int64_be` / `:long_long_be` - signed 64bit integer (big endian)
27
+ * `:int64_ne` / `:long_long_ne` - signed 64bit integer (network endian)
28
+ * `:uint64` / `:ulong_long` - unsigned 64bit integer
29
+ * `:uint64_le` / `:ulong_long_le` - unsigned 64bit integer (little endian)
30
+ * `:uint64_be` / `:ulong_long_be` - unsigned 64bit integer (big endian)
31
+ * `:uint64_ne` / `ulong_long_ne` - unsigned 64bit integer (network endian)
32
+ * `:float` - single precision 32bit floating-point number
33
+ * `:float_le` - single precision 32bit floating-point number (little endian)
34
+ * `:float_be` - single precision 32bit floating-point number (big endian)
35
+ * `:float_ne` - single precision 32bit floating-point number (network endian)
36
+ * `:double` - double precision 64bit floating-point number
37
+ * `:double_le` - double precision 64bit floating-point number (little endian)
38
+ * `:double_be` - double precision 64bit floating-point number (big endian)
39
+ * `:double_ne` - double precision 64bit floating-point number (network endian)
40
+ * Added support for optionally skipping N bytes or reading at most N bytes of
41
+ data (ex: `offset: 10` and `length: 100`).
42
+ * Added support for optional zero-padding of the data so it aligns with the type
43
+ size (ex: `zero_pad: true`).
44
+ * Added support for displaying the index in a separate numeric base than the
45
+ numeric columns (ex: `index_base: 10, base: 2`). Defaults to base 16.
46
+ * Added support for omitting repeating rows with a `*` (ex: `repeating: true` or
47
+ `repeating: false` to disable).
48
+ * Added support for grouping columns together like GNU `hexdump -C` (ex:
49
+ `group_columns: 4`).
50
+ * Added support for grouping characters together (ex: `group_chars: 4`).
51
+ * Added support for grouping characters together to align with the type's size
52
+ (ex: `group_chars: :type`).
53
+ * Added support for displaying UTF-8 characters or other character encodings.
54
+ * Added support for disabling the characters column entirely
55
+ (ex: `chars_column: false`).
56
+ * Added support for ANSI styling and highlighting (ex: `style: {...}` and
57
+ `highlights: {...}`).
58
+ * Added {Hexdump::ModuleMethods} to provide a top-level
59
+ {Hexdump::ModuleMethods#hexdump hexdump} method.
60
+ * Include {Hexdump::ModuleMethods} into {Kernel} by default.
61
+ * Added preliminary truffleruby support.
62
+ * Only issue was https://github.com/oracle/truffleruby/issues/2426
63
+ * `hexdump` methods now accept a block for configuring the hexdump instance.
64
+ * Renamed `Hexdump::Dumper` to {Hexdump::Hexdump}.
65
+ * Renamed the `:width` option to `:columns`.
66
+
1
67
  ### 0.3.0 / 2021-04-10
2
68
 
3
69
  * Require Ruby >= 2.0.0.
@@ -22,7 +88,7 @@
22
88
  ### 0.2.2 / 2012-05-27
23
89
 
24
90
  * Added {Hexdump::VERSION}.
25
- * Rescue `RangeError`s in {Hexdump::Dumper#format_printable}.
91
+ * Rescue `RangeError`s in `Hexdump::Dumper#format_printable`.
26
92
  * Fixed a typo in `benchmarks/hexdump.rb` (thanks ColMcp).
27
93
  * Fixed a typo in Source URL, in the README (thanks Lawrence Woodman).
28
94
  * Documented the `:endian` option for {Hexdump.dump}.
@@ -31,7 +97,7 @@
31
97
 
32
98
  ### 0.2.1 / 2011-06-11
33
99
 
34
- * Fixed a major bug in {Hexdump::Dumper#dump}, where the line buffers
100
+ * Fixed a major bug in `Hexdump::Dumper#dump`, where the line buffers
35
101
  were not being cleared.
36
102
 
37
103
  ### 0.2.0 / 2011-06-11
data/Gemfile CHANGED
@@ -8,4 +8,5 @@ group :development do
8
8
  gem 'rspec', '~> 3.0'
9
9
  gem 'kramdown'
10
10
  gem 'yard', '~> 0.9'
11
+ gem 'yard-spellcheck', require: false
11
12
  end
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  * [Source](https://github.com/postmodern/hexdump.rb)
6
6
  * [Issues](https://github.com/postmodern/hexdump.rb/issues)
7
7
  * [Documentation](http://rubydoc.info/gems/hexdump/frames)
8
- * [Email](mailto:postmodern.mod3 at gmail.com)
9
8
 
10
9
  ## Description
11
10
 
@@ -13,152 +12,504 @@ Simple and Fast hexdumping for Ruby.
13
12
 
14
13
  ## Features
15
14
 
15
+ * Supports printing ASCII, hexadecimal, decimal, octal and binary bytes.
16
+ * Supports hexdumping bytes, characters, signed/unsigned integers,
17
+ floating-point numbers, and in little/big/network endian byte orders:
18
+ * `char` - signed 8bit ASCII character
19
+ * `uchar` - unsigned 8bit ASCII character
20
+ * `int8` - signed 8bit integer
21
+ * `uin8` / `byte` - unsigned 8bit integer (default)
22
+ * `int16` / `short` - signed 16bit integer
23
+ * `int16_le` / `short_le` - signed 16bit integer (little endian)
24
+ * `int16_be` / `short_be` - signed 16bit integer (big endian)
25
+ * `int16_ne` / `short_ne` - signed 16bit integer (network endian)
26
+ * `uint16` / `ushort` - unsigned 16bit integer
27
+ * `uint16_le` / `ushort_le` - unsigned 16bit integer (little endian)
28
+ * `uint16_be` / `ushort_be` - unsigned 16bit integer (big endian)
29
+ * `uint16_ne` / `ushort_ne` - unsigned 16bit integer (network endian)
30
+ * `int32` / `int` / `long` - signed 32bit integer
31
+ * `int32_le` / `int_le` / `long_le` - signed 32bit integer (little endian)
32
+ * `int32_be` / `int_be` / `long_be` - signed 32bit integer (big endian)
33
+ * `int32_ne` / `int_ne` / `long_ne` - signed 32bit integer (network endian)
34
+ * `uint32` / `uint` / `ulong` - unsigned 32bit integer
35
+ * `uint32_le` / `uint_le` / `ulong_le` - unsigned 32bit integer
36
+ (little endian)
37
+ * `uint32_be` / `uint_be` / `ulong_be` - unsigned 32bit integer (big endian)
38
+ * `uint32_ne` / `uint_ne` / `ulong_ne` - unsigned 32bit integer
39
+ (network endian)
40
+ * `int64` / `long_long` - signed 64bit integer
41
+ * `int64_le` / `long_long_le` - signed 64bit integer (little endian)
42
+ * `int64_be` / `long_long_be` - signed 64bit integer (big endian)
43
+ * `int64_ne` / `long_long_ne` - signed 64bit integer (network endian)
44
+ * `uint64` / `ulong_long` - unsigned 64bit integer
45
+ * `uint64_le` / `ulong_long_le` - unsigned 64bit integer (little endian)
46
+ * `uint64_be` / `ulong_long_be` - unsigned 64bit integer (big endian)
47
+ * `uint64_ne` / `ulong_long_ne` - unsigned 64bit integer (network endian)
48
+ * `float` - single precision 32bit floating-point number
49
+ * `float_le` - single precision 32bit floating-point number (little endian)
50
+ * `float_be` - single precision 32bit floating-point number (big endian)
51
+ * `float_ne` - single precision 32bit floating-point number (network endian)
52
+ * `double` - double precision 64bit floating-point number
53
+ * `double_le` - double precision 64bit floating-point number (little endian)
54
+ * `double_be` - double precision 64bit floating-point number (big endian)
55
+ * `double_ne` - double precision 64bit floating-point number (network endian)
56
+ * Supports optionally skipping N bytes or reading at most N bytes of data.
57
+ * Supports optional zero-padding of the data.
58
+ * Supports omitting repeating rows with a `*`.
59
+ * Supports grouping columns together like GNU `hexdump -C`.
60
+ * Supports grouping characters together to align with the type's size.
61
+ * Supports displaying characters inline like GNU `hexdump -c`.
62
+ * Supports displaying UTF-8 characters or other character encodings.
63
+ * Supports ANSI styling and highlighting.
16
64
  * Can hexdump any Object supporting the `each_byte` method.
17
65
  * Can send the hexdump output to any Object supporting the `<<` method.
18
- * Can yield each line of hexdump, instead of printing the output.
19
- * Supports printing ASCII, hexadecimal, decimal, octal and binary bytes.
20
- * Supports hexdumping bytes (8bit), words (16bit), double-words (32bit), and
21
- quad-words (64bit).
22
- * Supports Little Endian and Big Endian modes.
23
66
  * Makes {String}, {StringIO}, {IO}, {File} objects hexdumpable.
24
67
  * Fast-ish.
25
68
 
69
+ ## Install
70
+
71
+ ```shell
72
+ $ gem install hexdump
73
+ ```
74
+
75
+ ### gemspec
76
+
77
+ ```ruby
78
+ gem.add_dependency 'hexdump', '~> 1.0'
79
+ ```
80
+
81
+ ### Gemfile
82
+
83
+ ```ruby
84
+ gem 'hexdump', '~> 1.0'
85
+ ```
86
+
26
87
  ## Examples
27
88
 
28
- require 'hexdump'
29
-
30
- data = "hello\x00"
31
-
32
- Hexdump.dump(data)
33
- # 00000000 68 65 6c 6c 6f 00 |hello.|
34
- # 00000006
35
-
36
- data.hexdump
37
- # 00000000 68 65 6c 6c 6f 00 |hello.|
38
- # 00000006
39
-
40
- File.open('dump.txt','w') do |file|
41
- data.hexdump(:output => file)
42
- end
43
-
44
- # iterate over the hexdump lines
45
- data.hexdump do |index,hex,printable|
46
- index # => 0
47
- hex # => ["68", "65", "6c", "6c", "6f", "00"]
48
- printable # => ["h", "e", "l", "l", "o", "."]
49
- end
50
- # => 6
51
-
52
- # configure the width of the hexdump
53
- Hexdump.dump('A' * 30, width: 10)
54
- # 00000000 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
55
- # 0000000a 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
56
- # 00000014 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
57
- # 0000001e
58
-
59
- Hexdump.dump(data, ascii: true)
60
- # 00000000 h e l l o 00 |hello.|
61
- # 00000006
62
-
63
- Hexdump.dump(data, base: 16)
64
- # 00000000 68 65 6c 6c 6f 00 |hello.|
65
- # 00000006
66
-
67
- Hexdump.dump(data, base: :decimal)
68
- # 00000000 104 101 108 108 111 0 |hello.|
69
- # 00000006
70
-
71
- Hexdump.dump(data, base: :octal)
72
- # 00000000 0150 0145 0154 0154 0157 0000 |hello.|
73
- # 00000006
74
-
75
- Hexdump.dump(data, base: :binary)
76
- # 00000000 01101000 01100101 01101100 01101100 01101111 00000000 |hello.|
77
- # 00000006
78
-
79
- ("ABC" * 10).hexdump(word_size: 2)
80
- # 00000000 4241 4143 4342 4241 4143 4342 4241 4143 |䉁䅃䍂䉁䅃䍂䉁䅃|
81
- # 00000010 4342 4241 4143 4342 4241 4143 4342 |䍂䉁䅃䍂䉁䅃䍂|
82
- # 0000001e
89
+ ```ruby
90
+ require 'hexdump'
83
91
 
84
- ## Install
92
+ Hexdump.hexdump("hello\0")
93
+ # 00000000 68 65 6c 6c 6f 00 |hello.|
94
+ # 00000006
95
+ ```
96
+
97
+ ### Core Extensions
98
+
99
+ ```ruby
100
+ "hello\0".hexdump
101
+ # 00000000 68 65 6c 6c 6f 00 |hello.|
102
+ # 00000006
103
+ ```
104
+
105
+ ```ruby
106
+ File.hexdump("/bin/ls")
107
+ # ...
108
+ ```
109
+
110
+ ### Output (file)
111
+
112
+ ```ruby
113
+ File.open('dump.txt','w') do |file|
114
+ data.hexdump(output: file)
115
+ end
116
+ ```
117
+
118
+ ### UTF-8
119
+
120
+ ```ruby
121
+ Hexdump.hexdump("\u8000" * 8, encoding: :utf8)
122
+ # 00000000 e8 80 80 e8 80 80 e8 80 80 e8 80 80 e8 80 80 e8 |耀耀耀耀耀.|
123
+ # 00000010 80 80 e8 80 80 e8 80 80 |..耀耀|
124
+ # 00000018
125
+ ```
126
+
127
+ ### Columns
85
128
 
86
- $ gem install hexdump
129
+ ```ruby
130
+ Hexdump.hexdump('A' * 30, columns: 10)
131
+ # 00000000 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
132
+ # *
133
+ # 0000001e
134
+ ```
135
+
136
+ ### Repeating Columns
137
+
138
+ ```ruby
139
+ Hexdump.hexdump('A' * 30, columns: 10, repeating: true)
140
+ # 00000000 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
141
+ # 0000000a 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
142
+ # 00000014 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
143
+ # 0000001e
144
+ ```
145
+
146
+ ### Grouping Columns
147
+
148
+ ```ruby
149
+ Hexdump.hexdump("ABCD" * 8, columns: 16, group_columns: 4, repeating: true)
150
+ # 00000000 41 42 43 44 41 42 43 44 41 42 43 44 41 42 43 44 |ABCDABCDABCDABCD|
151
+ # 00000010 41 42 43 44 41 42 43 44 41 42 43 44 41 42 43 44 |ABCDABCDABCDABCD|
152
+ # 00000020
153
+ ```
154
+
155
+ ### Grouping Chars
156
+
157
+ ```ruby
158
+ Hexdump.hexdump("ABCD" * 8, group_chars: 4)
159
+ # 00000000 41 42 43 44 41 42 43 44 41 42 43 44 41 42 43 44 |ABCD|ABCD|ABCD|ABCD|
160
+ # *
161
+ # 00000020
162
+ ```
163
+
164
+ ### Grouping UTF-8 Chars
165
+
166
+ ```ruby
167
+ Hexdump.hexdump("\u8000" * 8, group_chars: 4, encoding: :utf8)
168
+ # 00000000 e8 80 80 e8 80 80 e8 80 80 e8 80 80 e8 80 80 e8 |耀.|...|.耀|耀.|
169
+ # 00000010 80 80 e8 80 80 e8 80 80 |...|.耀|
170
+ # 00000018
171
+ ```
172
+
173
+ ### Disable Chars
174
+
175
+ ```ruby
176
+ Hexdump.hexdump('A' * 30, chars_column: false)
177
+ 00000000 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41
178
+ 00000010 41 41 41 41 41 41 41 41 41 41 41 41 41 41
179
+ 0000001e
180
+ ```
181
+
182
+ ### Hexadecimal
183
+
184
+ ```ruby
185
+ Hexdump.hexdump("hello\0", base: 16)
186
+ # 00000000 68 65 6c 6c 6f 00 |hello.|
187
+ # 00000006
188
+ ```
189
+
190
+ ### Decimal
191
+
192
+ ```ruby
193
+ Hexdump.hexdump("hello\0", base: 10)
194
+ # 00000000 104 101 108 108 111 0 |hello.|
195
+ # 00000006
196
+ ```
197
+
198
+ ### Octal
199
+
200
+ ```ruby
201
+ Hexdump.hexdump("hello\0", base: 8)
202
+ # 00000000 0150 0145 0154 0154 0157 0000 |hello.|
203
+ # 00000006
204
+ ```
205
+
206
+ ### Binary
207
+
208
+ ```ruby
209
+ Hexdump.hexdump("hello\0", base: 2)
210
+ # 00000000 01101000 01100101 01101100 01101100 01101111 00000000 |hello.|
211
+ # 00000006
212
+ ```
213
+
214
+ ### UInt Type
215
+
216
+ ```ruby
217
+ Hexdump.hexdump("ABCD" * 7, type: :uint32)
218
+ # 00000000 44434241 44434241 44434241 44434241 |ABCDABCDABCDABCD|
219
+ # 00000010 44434241 44434241 44434241 |ABCDABCDABCD|
220
+ # 0000001c
221
+ ```
222
+
223
+ ### Little-endian
224
+
225
+ ```ruby
226
+ Hexdump.hexdump("ABCD" * 7, type: :uint32_le)
227
+ # 00000000 44434241 44434241 44434241 44434241 |ABCDABCDABCDABCD|
228
+ # 00000010 44434241 44434241 44434241 |ABCDABCDABCD|
229
+ # 0000001c
230
+ ```
231
+
232
+ ### Big-endian
233
+
234
+ ```ruby
235
+ Hexdump.hexdump("ABCD" * 7, type: :uint32_be)
236
+ # 00000000 41424344 41424344 41424344 41424344 |ABCDABCDABCDABCD|
237
+ # 00000010 41424344 41424344 41424344 |ABCDABCDABCD|
238
+ # 0000001c
239
+ ```
240
+
241
+ ### Int Type
242
+
243
+ ```ruby
244
+ Hexdump.hexdump([65535, -1].pack("LL"), type: :int32_be, base: 10)
245
+ # 00000000 65535 -1 |........|
246
+ # 00000008
247
+ ```
248
+
249
+ ### Char Type
250
+
251
+ ```ruby
252
+ Hexdump.hexdump("hello\0", type: :char)
253
+ # 00000000 h e l l o \0 |hello.|
254
+ # 00000006
255
+ ```
256
+
257
+ ### Float Type
258
+
259
+ ```ruby
260
+ Hexdump.hexdump([0.0, 1.0, -1.0, Float::NAN].pack('EEEE'), type: :float64_le)
261
+ # 00000000 0.000000e+00 1.000000e+00 |...............?|
262
+ # 00000010 -1.000000e+00 NaN |................|
263
+ # 00000020
264
+ ```
265
+
266
+ ### Skipping Data
267
+
268
+ ```ruby
269
+ Hexdump.hexdump("GARBAGEabc123", offset: 7)
270
+ # 00000007 61 62 63 31 32 33 |abc123|
271
+ # 0000000d
272
+ ```
273
+
274
+ ### Zero-padding
275
+
276
+ ```ruby
277
+ Hexdump.hexdump(("ABCD" * 4) + "AB", type: :uint32_be, zero_pad: true)
278
+ # 00000000 41424344 41424344 41424344 41424344 |ABCDABCDABCDABCD|
279
+ # 00000010 41420000 |AB..|
280
+ # 00000014
281
+ ```
282
+
283
+ ### ANSI Styling
284
+
285
+ ```ruby
286
+ Hexdump.hexdump("ABCD", style: {index: :white, numeric: :green, chars: :cyan})
287
+ ```
288
+
289
+ ### ANSI Highlighting
290
+
291
+ ```ruby
292
+ Hexdump.hexdump((0..255).map(&:chr).join, highlights: {
293
+ index: {/00$/ => [:white, :bold]},
294
+ numeric: {
295
+ /^[8-f][0-9a-f]$/ => :faint,
296
+ /f/ => :cyan,
297
+ '00' => [:black, :on_red]
298
+ },
299
+ chars: {/[^\.]+/ => :green}
300
+ })
301
+ ```
302
+
303
+ ### Block Configuration
304
+
305
+ ```ruby
306
+ Hexdump.hexdump("hello\0") do |hex|
307
+ hex.type = :uint16_le
308
+ hex.group_chars = :type
309
+ # ...
310
+ end
311
+ # 00000000 6568 6c6c 006f |he|ll|o.|
312
+ # 00000006
313
+ ```
87
314
 
88
315
  ## Benchmarks
89
316
 
90
- Benchmarks show {Hexdump.dump} processing 25M of data.
91
-
92
- ### Ruby 2.7.3
93
-
94
- ```
95
- user system total real
96
- Hexdump.dump (output) 10.283433 0.000748 10.284181 ( 10.328899)
97
- Hexdump.dump width=256 (output) 8.803228 0.005973 8.809201 ( 8.838375)
98
- Hexdump.dump ascii=true (output) 10.740975 0.001903 10.742878 ( 10.779777)
99
- Hexdump.dump word_size=2 (output) 15.163195 0.000989 15.164184 ( 15.220481)
100
- Hexdump.dump word_size=4 (output) 14.279406 0.003840 14.283246 ( 14.345357)
101
- Hexdump.dump word_size=8 (output) 7.715803 0.002879 7.718682 ( 7.746389)
102
- Hexdump.dump (block) 5.543268 0.000980 5.544248 ( 5.561494)
103
- Hexdump.dump width=256 (block) 5.438946 0.000000 5.438946 ( 5.455742)
104
- Hexdump.dump ascii=true (block) 6.082787 0.000924 6.083711 ( 6.106234)
105
- Hexdump.dump word_size=2 (block) 11.439610 0.000983 11.440593 ( 11.483788)
106
- Hexdump.dump word_size=4 (block) 11.111633 0.000954 11.112587 ( 11.158416)
107
- Hexdump.dump word_size=8 (block) 5.397569 0.002896 5.400465 ( 5.426971)
108
- ```
109
-
110
- ### Ruby 3.0.1
111
-
112
- ```
113
- user system total real
114
- Hexdump.dump (output) 12.064022 0.001165 12.065187 ( 12.118272)
115
- Hexdump.dump width=256 (output) 10.228743 0.009920 10.238663 ( 10.279783)
116
- Hexdump.dump ascii=true (output) 12.532913 0.000000 12.532913 ( 12.582665)
117
- Hexdump.dump word_size=2 (output) 17.685782 0.000000 17.685782 ( 17.770686)
118
- Hexdump.dump word_size=4 (output) 15.835564 0.000000 15.835564 ( 15.917552)
119
- Hexdump.dump word_size=8 (output) 8.436831 0.000000 8.436831 ( 8.473445)
120
- Hexdump.dump (block) 6.482589 0.000000 6.482589 ( 6.504816)
121
- Hexdump.dump width=256 (block) 6.360828 0.000000 6.360828 ( 6.383705)
122
- Hexdump.dump ascii=true (block) 6.911868 0.000000 6.911868 ( 6.936795)
123
- Hexdump.dump word_size=2 (block) 13.120488 0.000000 13.120488 ( 13.179957)
124
- Hexdump.dump word_size=4 (block) 12.349516 0.000000 12.349516 ( 12.412972)
125
- Hexdump.dump word_size=8 (block) 5.814830 0.000000 5.814830 ( 5.837822)
126
- ```
127
-
128
- ### JRuby 9.2.16.0
129
-
130
- ```
131
- user system total real
132
- Hexdump.dump (output) 13.090000 0.240000 13.330000 ( 11.226466)
133
- Hexdump.dump width=256 (output) 9.350000 0.030000 9.380000 ( 9.165070)
134
- Hexdump.dump ascii=true (output) 10.910000 0.050000 10.960000 ( 10.665791)
135
- Hexdump.dump word_size=2 (output) 13.760000 0.150000 13.910000 ( 12.268307)
136
- Hexdump.dump word_size=4 (output) 11.940000 0.090000 12.030000 ( 11.107564)
137
- Hexdump.dump word_size=8 (output) 8.170000 0.040000 8.210000 ( 7.419708)
138
- Hexdump.dump (block) 7.840000 0.020000 7.860000 ( 7.777749)
139
- Hexdump.dump width=256 (block) 7.540000 0.000000 7.540000 ( 7.466315)
140
- Hexdump.dump ascii=true (block) 7.680000 0.010000 7.690000 ( 7.622393)
141
- Hexdump.dump word_size=2 (block) 9.830000 0.020000 9.850000 ( 9.693596)
142
- Hexdump.dump word_size=4 (block) 9.010000 0.020000 9.030000 ( 8.998687)
143
- Hexdump.dump word_size=8 (block) 5.740000 0.030000 5.770000 ( 5.709127)
144
- ```
145
-
146
- ### TruffleRuby 21.0.0
147
-
148
- ```
149
- user system total real
150
- Hexdump.dump (output) 25.818995 0.855689 26.674684 ( 22.376015)
151
- Hexdump.dump width=256 (output) 20.489077 0.125966 20.615043 ( 18.301748)
152
- Hexdump.dump ascii=true (output) 25.214678 0.098018 25.312696 ( 21.714985)
153
- Hexdump.dump word_size=2 (output) 28.380387 0.192277 28.572664 ( 23.736887)
154
- Hexdump.dump word_size=4 (output) 31.348977 0.134854 31.483831 ( 27.710968)
155
- Hexdump.dump word_size=8 (output) 18.850093 0.100256 18.950349 ( 13.921720)
156
- Hexdump.dump (block) 7.792878 0.050542 7.843420 ( 6.003789)
157
- Hexdump.dump width=256 (block) 6.526531 0.015898 6.542429 ( 5.777169)
158
- Hexdump.dump ascii=true (block) 7.425399 0.030799 7.456198 ( 5.705369)
159
- Hexdump.dump word_size=2 (block) 12.629775 0.028653 12.658428 ( 11.115049)
160
- Hexdump.dump word_size=4 (block) 20.372094 0.010807 20.382901 ( 19.758073)
161
- Hexdump.dump word_size=8 (block) 8.828653 0.010889 8.839542 ( 8.017241)
317
+ Benchmarks show hexdumping 1Mb of random data.
318
+
319
+ ### Ruby 2.7.4
320
+
321
+ ```
322
+ user system total real
323
+ Hexdump.hexdump(data) 1.148697 0.025829 1.174526 ( 1.183447)
324
+ Hexdump.hexdump(data, repeating: false) 1.050473 0.000000 1.050473 ( 1.057167)
325
+ Hexdump.hexdump(data, chars_column: false) 0.878459 0.002912 0.881371 ( 0.888779)
326
+ Hexdump.hexdump(data, columns: 256) 0.793922 0.008785 0.802707 ( 0.810535)
327
+ Hexdump.hexdump(data, group_columns: 4) 1.309818 0.000000 1.309818 ( 1.320721)
328
+ Hexdump.hexdump(data, group_chars: 4) 1.949181 0.000000 1.949181 ( 1.975533)
329
+ Hexdump.hexdump(data, encoding: :utf8) 1.292495 0.000000 1.292495 ( 1.302071)
330
+ Hexdump.hexdump(data, type: :char) 1.168044 0.000000 1.168044 ( 1.177700)
331
+ Hexdump.hexdump(data, type: :uchar) 1.033165 0.000000 1.033165 ( 1.041185)
332
+ Hexdump.hexdump(data, type: :int8) 1.310548 0.000000 1.310548 ( 1.319847)
333
+ Hexdump.hexdump(data, type: :uint8) 1.035534 0.000000 1.035534 ( 1.041428)
334
+ Hexdump.hexdump(data, type: :int16) 1.351306 0.009906 1.361212 ( 1.370048)
335
+ Hexdump.hexdump(data, type: :int16_le) 1.320781 0.002981 1.323762 ( 1.331747)
336
+ Hexdump.hexdump(data, type: :int16_be) 1.401554 0.003986 1.405540 ( 1.414568)
337
+ Hexdump.hexdump(data, type: :int16_ne) 1.367864 0.000000 1.367864 ( 1.376459)
338
+ Hexdump.hexdump(data, type: :uint16) 1.425247 0.003965 1.429212 ( 1.438618)
339
+ Hexdump.hexdump(data, type: :uint16_le) 1.399240 0.002979 1.402219 ( 1.411098)
340
+ Hexdump.hexdump(data, type: :uint16_be) 1.409289 0.006960 1.416249 ( 1.424767)
341
+ Hexdump.hexdump(data, type: :uint16_ne) 1.288829 0.000001 1.288830 ( 1.296091)
342
+ Hexdump.hexdump(data, type: :int32) 1.089239 0.000000 1.089239 ( 1.094715)
343
+ Hexdump.hexdump(data, type: :int32_le) 1.429353 0.000003 1.429356 ( 1.441620)
344
+ Hexdump.hexdump(data, type: :int32_be) 1.472933 0.000000 1.472933 ( 1.486328)
345
+ Hexdump.hexdump(data, type: :int32_ne) 1.357824 0.000000 1.357824 ( 1.369258)
346
+ Hexdump.hexdump(data, type: :uint32) 1.214704 0.000000 1.214704 ( 1.222920)
347
+ Hexdump.hexdump(data, type: :uint32_le) 1.253424 0.000000 1.253424 ( 1.262441)
348
+ Hexdump.hexdump(data, type: :uint32_be) 1.325268 0.000000 1.325268 ( 1.335447)
349
+ Hexdump.hexdump(data, type: :uint32_ne) 1.314893 0.000819 1.315712 ( 1.328889)
350
+ Hexdump.hexdump(data, type: :int64) 1.083071 0.000000 1.083071 ( 1.092108)
351
+ Hexdump.hexdump(data, type: :int64_le) 1.076378 0.000000 1.076378 ( 1.084785)
352
+ Hexdump.hexdump(data, type: :int64_be) 0.998069 0.000000 0.998069 ( 1.005166)
353
+ Hexdump.hexdump(data, type: :int64_ne) 0.990422 0.000000 0.990422 ( 1.005638)
354
+ Hexdump.hexdump(data, type: :uint64) 1.010946 0.000000 1.010946 ( 1.018339)
355
+ Hexdump.hexdump(data, type: :uint64_le) 0.961576 0.000000 0.961576 ( 0.967806)
356
+ Hexdump.hexdump(data, type: :uint64_be) 0.979367 0.000000 0.979367 ( 0.985515)
357
+ Hexdump.hexdump(data, type: :uint64_ne) 1.017737 0.000000 1.017737 ( 1.024689)
358
+ Hexdump.hexdump(data, type: :float32) 1.237278 0.000000 1.237278 ( 1.245206)
359
+ Hexdump.hexdump(data, type: :float32_le) 1.233321 0.000000 1.233321 ( 1.241154)
360
+ Hexdump.hexdump(data, type: :float32_be) 1.245740 0.000000 1.245740 ( 1.253952)
361
+ Hexdump.hexdump(data, type: :float32_ne) 1.256216 0.000000 1.256216 ( 1.264893)
362
+ Hexdump.hexdump(data, type: :float64) 1.122882 0.000000 1.122882 ( 1.130954)
363
+ Hexdump.hexdump(data, type: :float64_le) 1.117593 0.000000 1.117593 ( 1.125222)
364
+ Hexdump.hexdump(data, type: :float64_be) 1.139602 0.000000 1.139602 ( 1.147980)
365
+ Hexdump.hexdump(data, type: :float64_ne) 1.142568 0.000000 1.142568 ( 1.150949)
366
+ ```
367
+
368
+ ### Ruby 3.0.2
369
+
370
+ ```
371
+ user system total real
372
+ Hexdump.hexdump(data) 0.902383 0.046875 0.949258 ( 0.953623)
373
+ Hexdump.hexdump(data, repeating: false) 0.892407 0.000046 0.892453 ( 0.896401)
374
+ Hexdump.hexdump(data, chars_column: false) 0.705909 0.001029 0.706938 ( 0.709924)
375
+ Hexdump.hexdump(data, columns: 256) 0.627444 0.009986 0.637430 ( 0.640324)
376
+ Hexdump.hexdump(data, group_columns: 4) 1.081550 0.001041 1.082591 ( 1.087987)
377
+ Hexdump.hexdump(data, group_chars: 4) 1.444519 0.000000 1.444519 ( 1.452809)
378
+ Hexdump.hexdump(data, encoding: :utf8) 1.078177 0.000003 1.078180 ( 1.082981)
379
+ Hexdump.hexdump(data, type: :char) 0.865217 0.000000 0.865217 ( 0.868752)
380
+ Hexdump.hexdump(data, type: :uchar) 0.736559 0.000000 0.736559 ( 0.739721)
381
+ Hexdump.hexdump(data, type: :int8) 1.042024 0.000000 1.042024 ( 1.046687)
382
+ Hexdump.hexdump(data, type: :uint8) 0.917350 0.000005 0.917355 ( 0.921428)
383
+ Hexdump.hexdump(data, type: :int16) 1.351638 0.004978 1.356616 ( 1.363879)
384
+ Hexdump.hexdump(data, type: :int16_le) 1.315200 0.006944 1.322144 ( 1.329052)
385
+ Hexdump.hexdump(data, type: :int16_be) 1.421759 0.005966 1.427725 ( 1.435760)
386
+ Hexdump.hexdump(data, type: :int16_ne) 1.444364 0.001995 1.446359 ( 1.454039)
387
+ Hexdump.hexdump(data, type: :uint16) 1.491169 0.001000 1.492169 ( 1.500542)
388
+ Hexdump.hexdump(data, type: :uint16_le) 1.439111 0.000000 1.439111 ( 1.447745)
389
+ Hexdump.hexdump(data, type: :uint16_be) 1.464961 0.000836 1.465797 ( 1.473807)
390
+ Hexdump.hexdump(data, type: :uint16_ne) 1.407008 0.000808 1.407816 ( 1.415236)
391
+ Hexdump.hexdump(data, type: :int32) 1.048519 0.000004 1.048523 ( 1.053326)
392
+ Hexdump.hexdump(data, type: :int32_le) 1.080497 0.000000 1.080497 ( 1.085598)
393
+ Hexdump.hexdump(data, type: :int32_be) 1.033985 0.000000 1.033985 ( 1.038472)
394
+ Hexdump.hexdump(data, type: :int32_ne) 1.057491 0.000000 1.057491 ( 1.062123)
395
+ Hexdump.hexdump(data, type: :uint32) 1.019488 0.000000 1.019488 ( 1.023838)
396
+ Hexdump.hexdump(data, type: :uint32_le) 1.014077 0.000003 1.014080 ( 1.018370)
397
+ Hexdump.hexdump(data, type: :uint32_be) 1.038020 0.000000 1.038020 ( 1.042756)
398
+ Hexdump.hexdump(data, type: :uint32_ne) 1.047465 0.000000 1.047465 ( 1.052377)
399
+ Hexdump.hexdump(data, type: :int64) 0.842281 0.000000 0.842281 ( 0.845988)
400
+ Hexdump.hexdump(data, type: :int64_le) 0.840408 0.000000 0.840408 ( 0.844103)
401
+ Hexdump.hexdump(data, type: :int64_be) 0.845470 0.000002 0.845472 ( 0.849219)
402
+ Hexdump.hexdump(data, type: :int64_ne) 0.843975 0.000000 0.843975 ( 0.847644)
403
+ Hexdump.hexdump(data, type: :uint64) 0.836761 0.000000 0.836761 ( 0.840326)
404
+ Hexdump.hexdump(data, type: :uint64_le) 0.828863 0.000000 0.828863 ( 0.832319)
405
+ Hexdump.hexdump(data, type: :uint64_be) 0.839492 0.000001 0.839493 ( 0.843017)
406
+ Hexdump.hexdump(data, type: :uint64_ne) 0.843799 0.000000 0.843799 ( 0.847764)
407
+ Hexdump.hexdump(data, type: :float32) 1.091306 0.000000 1.091306 ( 1.096429)
408
+ Hexdump.hexdump(data, type: :float32_le) 1.077634 0.000000 1.077634 ( 1.082633)
409
+ Hexdump.hexdump(data, type: :float32_be) 1.085840 0.000986 1.086826 ( 1.092056)
410
+ Hexdump.hexdump(data, type: :float32_ne) 1.093757 0.000000 1.093757 ( 1.099011)
411
+ Hexdump.hexdump(data, type: :float64) 0.873676 0.010942 0.884618 ( 0.888978)
412
+ Hexdump.hexdump(data, type: :float64_le) 0.865006 0.003984 0.868990 ( 0.873156)
413
+ Hexdump.hexdump(data, type: :float64_be) 0.879795 0.009947 0.889742 ( 0.894389)
414
+ Hexdump.hexdump(data, type: :float64_ne) 0.876483 0.010934 0.887417 ( 0.892222)
415
+ ```
416
+
417
+ ### JRuby 9.2.19.0
418
+
419
+ ```
420
+ user system total real
421
+ Hexdump.hexdump(data) 6.440000 0.260000 6.700000 ( 1.990004)
422
+ Hexdump.hexdump(data, repeating: false) 1.920000 0.010000 1.930000 ( 0.973891)
423
+ Hexdump.hexdump(data, chars_column: false) 1.680000 0.010000 1.690000 ( 0.848573)
424
+ Hexdump.hexdump(data, columns: 256) 0.920000 0.010000 0.930000 ( 0.703203)
425
+ Hexdump.hexdump(data, group_columns: 4) 2.070000 0.010000 2.080000 ( 1.119408)
426
+ Hexdump.hexdump(data, group_chars: 4) 2.200000 0.010000 2.210000 ( 1.427454)
427
+ Hexdump.hexdump(data, encoding: :utf8) 2.280000 0.010000 2.290000 ( 1.148070)
428
+ Hexdump.hexdump(data, type: :char) 1.970000 0.020000 1.990000 ( 1.022860)
429
+ Hexdump.hexdump(data, type: :uchar) 0.940000 0.000000 0.940000 ( 0.780674)
430
+ Hexdump.hexdump(data, type: :int8) 1.580000 0.000000 1.580000 ( 1.086830)
431
+ Hexdump.hexdump(data, type: :uint8) 0.980000 0.010000 0.990000 ( 0.937851)
432
+ Hexdump.hexdump(data, type: :int16) 2.730000 0.030000 2.760000 ( 1.571684)
433
+ Hexdump.hexdump(data, type: :int16_le) 1.620000 0.000000 1.620000 ( 1.354835)
434
+ Hexdump.hexdump(data, type: :int16_be) 1.700000 0.010000 1.710000 ( 1.430056)
435
+ Hexdump.hexdump(data, type: :int16_ne) 1.640000 0.000000 1.640000 ( 1.437230)
436
+ Hexdump.hexdump(data, type: :uint16) 2.190000 0.100000 2.290000 ( 1.801601)
437
+ Hexdump.hexdump(data, type: :uint16_le) 1.770000 0.010000 1.780000 ( 1.585609)
438
+ Hexdump.hexdump(data, type: :uint16_be) 1.720000 0.000000 1.720000 ( 1.555715)
439
+ Hexdump.hexdump(data, type: :uint16_ne) 1.760000 0.010000 1.770000 ( 1.540340)
440
+ Hexdump.hexdump(data, type: :int32) 1.430000 0.000000 1.430000 ( 1.133868)
441
+ Hexdump.hexdump(data, type: :int32_le) 1.060000 0.000000 1.060000 ( 1.031721)
442
+ Hexdump.hexdump(data, type: :int32_be) 1.130000 0.010000 1.140000 ( 1.096841)
443
+ Hexdump.hexdump(data, type: :int32_ne) 1.080000 0.000000 1.080000 ( 1.074743)
444
+ Hexdump.hexdump(data, type: :uint32) 1.560000 0.010000 1.570000 ( 1.053369)
445
+ Hexdump.hexdump(data, type: :uint32_le) 1.070000 0.000000 1.070000 ( 1.001372)
446
+ Hexdump.hexdump(data, type: :uint32_be) 1.460000 0.020000 1.480000 ( 1.080869)
447
+ Hexdump.hexdump(data, type: :uint32_ne) 1.120000 0.010000 1.130000 ( 0.876941)
448
+ Hexdump.hexdump(data, type: :int64) 1.510000 0.010000 1.520000 ( 0.865030)
449
+ Hexdump.hexdump(data, type: :int64_le) 0.860000 0.000000 0.860000 ( 0.770903)
450
+ Hexdump.hexdump(data, type: :int64_be) 0.820000 0.000000 0.820000 ( 0.768356)
451
+ Hexdump.hexdump(data, type: :int64_ne) 0.760000 0.010000 0.770000 ( 0.752532)
452
+ Hexdump.hexdump(data, type: :uint64) 2.430000 0.000000 2.430000 ( 1.011133)
453
+ Hexdump.hexdump(data, type: :uint64_le) 0.850000 0.010000 0.860000 ( 0.823235)
454
+ Hexdump.hexdump(data, type: :uint64_be) 0.870000 0.000000 0.870000 ( 0.822799)
455
+ Hexdump.hexdump(data, type: :uint64_ne) 0.900000 0.000000 0.900000 ( 0.829247)
456
+ Hexdump.hexdump(data, type: :float32) 3.700000 0.020000 3.720000 ( 1.862630)
457
+ Hexdump.hexdump(data, type: :float32_le) 1.430000 0.010000 1.440000 ( 1.372024)
458
+ Hexdump.hexdump(data, type: :float32_be) 1.360000 0.010000 1.370000 ( 1.333000)
459
+ Hexdump.hexdump(data, type: :float32_ne) 1.390000 0.000000 1.390000 ( 1.354031)
460
+ Hexdump.hexdump(data, type: :float64) 2.830000 0.030000 2.860000 ( 1.705892)
461
+ Hexdump.hexdump(data, type: :float64_le) 1.370000 0.000000 1.370000 ( 1.356680)
462
+ Hexdump.hexdump(data, type: :float64_be) 1.430000 0.010000 1.440000 ( 1.392404)
463
+ Hexdump.hexdump(data, type: :float64_ne) 1.380000 0.000000 1.380000 ( 1.363983)
464
+ ```
465
+
466
+ ### TruffleRuby 21.2.0.1
467
+
468
+ ```
469
+ user system total real
470
+ Hexdump.hexdump(data) 7.456088 0.230339 7.686427 ( 2.378998)
471
+ Hexdump.hexdump(data, repeating: false) 5.737137 0.150997 5.888134 ( 1.781732)
472
+ Hexdump.hexdump(data, chars_column: false) 6.671704 0.064265 6.735969 ( 2.054377)
473
+ Hexdump.hexdump(data, columns: 256) 4.711081 0.023574 4.734655 ( 1.352932)
474
+ Hexdump.hexdump(data, group_columns: 4) 8.762291 0.133901 8.896192 ( 2.711132)
475
+ Hexdump.hexdump(data, group_chars: 4) 13.382068 0.127633 13.509701 ( 4.128705)
476
+ Hexdump.hexdump(data, encoding: :utf8) 8.591975 0.138969 8.730944 ( 2.676283)
477
+ Hexdump.hexdump(data, type: :char) 6.455997 0.059446 6.515443 ( 1.953656)
478
+ Hexdump.hexdump(data, type: :uchar) 6.201412 0.048587 6.249999 ( 1.732655)
479
+ Hexdump.hexdump(data, type: :int8) 8.712725 0.095197 8.807922 ( 2.587043)
480
+ Hexdump.hexdump(data, type: :uint8) 5.553536 0.074358 5.627894 ( 1.786634)
481
+ Hexdump.hexdump(data, type: :int16) 11.300609 0.114115 11.414724 ( 3.440795)
482
+ Hexdump.hexdump(data, type: :int16_le) 8.040891 0.060503 8.101394 ( 2.388759)
483
+ Hexdump.hexdump(data, type: :int16_be) 6.602434 0.087225 6.689659 ( 2.082091)
484
+ Hexdump.hexdump(data, type: :int16_ne) 5.448411 0.076425 5.524836 ( 1.696039)
485
+ Hexdump.hexdump(data, type: :uint16) 10.081909 0.157579 10.239488 ( 3.106461)
486
+ Hexdump.hexdump(data, type: :uint16_le) 6.847504 0.040543 6.888047 ( 2.069546)
487
+ Hexdump.hexdump(data, type: :uint16_be) 6.730759 0.149299 6.880058 ( 2.147346)
488
+ Hexdump.hexdump(data, type: :uint16_ne) 5.539179 0.108832 5.648011 ( 1.747539)
489
+ Hexdump.hexdump(data, type: :int32) 7.998790 0.058401 8.057191 ( 2.383304)
490
+ Hexdump.hexdump(data, type: :int32_le) 4.650657 0.081202 4.731859 ( 1.412741)
491
+ Hexdump.hexdump(data, type: :int32_be) 11.538588 0.089259 11.627847 ( 3.557763)
492
+ Hexdump.hexdump(data, type: :int32_ne) 9.605673 0.146677 9.752350 ( 2.995870)
493
+ Hexdump.hexdump(data, type: :uint32) 10.404964 0.106136 10.511100 ( 3.118580)
494
+ Hexdump.hexdump(data, type: :uint32_le) 4.851154 0.080325 4.931479 ( 1.463532)
495
+ Hexdump.hexdump(data, type: :uint32_be) 11.293044 0.100121 11.393165 ( 3.539708)
496
+ Hexdump.hexdump(data, type: :uint32_ne) 9.907893 0.122000 10.029893 ( 3.165294)
497
+ Hexdump.hexdump(data, type: :int64) 9.103719 0.102995 9.206714 ( 2.775106)
498
+ Hexdump.hexdump(data, type: :int64_le) 9.304751 0.180642 9.485393 ( 2.922495)
499
+ Hexdump.hexdump(data, type: :int64_be) 7.166353 0.089344 7.255697 ( 2.215438)
500
+ Hexdump.hexdump(data, type: :int64_ne) 6.874170 0.090186 6.964356 ( 2.113975)
501
+ Hexdump.hexdump(data, type: :uint64) 12.997911 0.165758 13.163669 ( 4.081488)
502
+ Hexdump.hexdump(data, type: :uint64_le) 8.949650 0.130855 9.080505 ( 2.712645)
503
+ Hexdump.hexdump(data, type: :uint64_be) 8.948030 0.173500 9.121530 ( 2.842953)
504
+ Hexdump.hexdump(data, type: :uint64_ne) 8.055399 0.153749 8.209148 ( 2.547932)
505
+ Hexdump.hexdump(data, type: :float32) 14.345624 0.241224 14.586848 ( 4.508393)
506
+ Hexdump.hexdump(data, type: :float32_le) 10.454524 0.103136 10.557660 ( 3.112175)
507
+ Hexdump.hexdump(data, type: :float32_be) 11.073294 0.202252 11.275546 ( 3.443881)
508
+ Hexdump.hexdump(data, type: :float32_ne) 9.990956 0.091216 10.082172 ( 3.022276)
509
+ Hexdump.hexdump(data, type: :float64) 16.629231 0.279989 16.909220 ( 5.163906)
510
+ Hexdump.hexdump(data, type: :float64_le) 13.761375 0.190385 13.951760 ( 4.129403)
511
+ Hexdump.hexdump(data, type: :float64_be) 16.121047 0.277863 16.398910 ( 5.019326)
512
+ Hexdump.hexdump(data, type: :float64_ne) 8.873162 0.068414 8.941576 ( 4.748072)
162
513
  ```
163
514
 
164
515
  ## Copyright