hexdump 0.2.1 → 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 (67) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/ruby.yml +29 -0
  3. data/.gitignore +4 -0
  4. data/.yardopts +1 -1
  5. data/ChangeLog.md +98 -1
  6. data/Gemfile +12 -0
  7. data/LICENSE.txt +1 -1
  8. data/README.md +490 -118
  9. data/Rakefile +7 -32
  10. data/benchmark.rb +54 -0
  11. data/gemspec.yml +9 -6
  12. data/hexdump.gemspec +57 -11
  13. data/lib/hexdump/chars.rb +46 -0
  14. data/lib/hexdump/core_ext/file.rb +84 -0
  15. data/lib/hexdump/core_ext/io.rb +7 -0
  16. data/lib/hexdump/core_ext/kernel.rb +7 -0
  17. data/lib/hexdump/core_ext/string.rb +7 -0
  18. data/lib/hexdump/core_ext/string_io.rb +9 -0
  19. data/lib/hexdump/core_ext.rb +5 -0
  20. data/lib/hexdump/extensions.rb +2 -4
  21. data/lib/hexdump/format_string.rb +43 -0
  22. data/lib/hexdump/hexdump.rb +769 -81
  23. data/lib/hexdump/mixin.rb +198 -0
  24. data/lib/hexdump/module_methods.rb +132 -0
  25. data/lib/hexdump/numeric/binary.rb +55 -0
  26. data/lib/hexdump/numeric/char_or_int.rb +90 -0
  27. data/lib/hexdump/numeric/decimal.rb +56 -0
  28. data/lib/hexdump/numeric/exceptions.rb +11 -0
  29. data/lib/hexdump/numeric/hexadecimal.rb +59 -0
  30. data/lib/hexdump/numeric/octal.rb +55 -0
  31. data/lib/hexdump/numeric.rb +5 -0
  32. data/lib/hexdump/reader.rb +314 -0
  33. data/lib/hexdump/theme/ansi.rb +81 -0
  34. data/lib/hexdump/theme/rule.rb +159 -0
  35. data/lib/hexdump/theme.rb +61 -0
  36. data/lib/hexdump/type.rb +232 -0
  37. data/lib/hexdump/types.rb +108 -0
  38. data/lib/hexdump/version.rb +4 -0
  39. data/lib/hexdump.rb +14 -2
  40. data/spec/chars_spec.rb +76 -0
  41. data/spec/core_ext_spec.rb +24 -0
  42. data/spec/hexdump_class_spec.rb +1708 -0
  43. data/spec/hexdump_module_spec.rb +23 -0
  44. data/spec/mixin_spec.rb +37 -0
  45. data/spec/numeric/binary_spec.rb +239 -0
  46. data/spec/numeric/char_or_int_spec.rb +210 -0
  47. data/spec/numeric/decimal_spec.rb +317 -0
  48. data/spec/numeric/hexadecimal_spec.rb +320 -0
  49. data/spec/numeric/octal_spec.rb +239 -0
  50. data/spec/reader_spec.rb +863 -0
  51. data/spec/spec_helper.rb +0 -1
  52. data/spec/theme/ansi_spec.rb +242 -0
  53. data/spec/theme/rule_spec.rb +199 -0
  54. data/spec/theme_spec.rb +94 -0
  55. data/spec/type_spec.rb +317 -0
  56. data/spec/types_spec.rb +904 -0
  57. metadata +91 -84
  58. data/.gemtest +0 -0
  59. data/benchmarks/hexdump.rb +0 -45
  60. data/lib/hexdump/dumper.rb +0 -441
  61. data/lib/hexdump/extensions/file.rb +0 -22
  62. data/lib/hexdump/extensions/io.rb +0 -7
  63. data/lib/hexdump/extensions/string.rb +0 -7
  64. data/lib/hexdump/extensions/string_io.rb +0 -9
  65. data/spec/dumper_spec.rb +0 -260
  66. data/spec/extensions_spec.rb +0 -20
  67. data/spec/hexdump_spec.rb +0 -29
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6c7d2cd541f81ae5ed4191d544eac913e7e9b2f55fad23320fedb00ce6b02eb2
4
+ data.tar.gz: 6c12dd82076f8b2bf1272ad47f9e509c6f0553642c9ad2079eeab38bca3dad36
5
+ SHA512:
6
+ metadata.gz: cf2a9fc5999b94a8ad91b5bcef2a001a66e1e2f9e177b37c7e256df6775b708d84e061b0024428f3c6a0834d42f148d714f0e200a923b64f979761d500f60088
7
+ data.tar.gz: 7044bdfd16ff11ac1cb38b9d1f9d28faf61d147d1f5f2932e37e018479de77c194e587e39342a45103c6c4acc2128f09463d1b56f44637f99e850103c07a7c87
@@ -0,0 +1,29 @@
1
+ name: CI
2
+
3
+ on: [ push, pull_request ]
4
+
5
+ jobs:
6
+ tests:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ fail-fast: false
10
+ matrix:
11
+ ruby:
12
+ - 2.4
13
+ - 2.5
14
+ - 2.6
15
+ - 2.7
16
+ - 3.0
17
+ - jruby
18
+ - truffleruby
19
+ name: Ruby ${{ matrix.ruby }}
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ - name: Install dependencies
27
+ run: bundle install --jobs 4 --retry 3
28
+ - name: Run tests
29
+ run: bundle exec rake test
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ /Gemfile.lock
2
+ /doc/
3
+ /pkg/
4
+ /vendor/bundle/
data/.yardopts CHANGED
@@ -1 +1 @@
1
- --markup markdown --title "hexdump Documentation" --protected
1
+ --markup markdown --title "hexdump Documentation" --protected --quiet
data/ChangeLog.md CHANGED
@@ -1,6 +1,103 @@
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
+
67
+ ### 0.3.0 / 2021-04-10
68
+
69
+ * Require Ruby >= 2.0.0.
70
+ * Added support for Ruby 3.0.
71
+ * {Hexdump.dump}, {Hexdump#dump}, and {Hexdump::Dumper#initialize} now accept
72
+ keyword arguments.
73
+ * {Hexdump::Dumper#each} now returns the total number of bytes read.
74
+ * {Hexdump::Dumper#dump} now prints the final number of bytes read on the last
75
+ line.
76
+ * Micro-optimizations to improve performance on JRuby and TruffleRuby.
77
+
78
+ ### 0.2.4 / 2020-09-26
79
+
80
+ * Default the `:output` option of {Hexdump.dump} to `$stdout` instead of
81
+ `STDOUT`, to support overriding the default stdout stream (@kylekyle).
82
+
83
+ ### 0.2.3 / 2012-05-28
84
+
85
+ * Fixed a typo in the gemspec, which incorrectly set
86
+ `required_rubygems_version` to the same value as `required_ruby_version`.
87
+
88
+ ### 0.2.2 / 2012-05-27
89
+
90
+ * Added {Hexdump::VERSION}.
91
+ * Rescue `RangeError`s in `Hexdump::Dumper#format_printable`.
92
+ * Fixed a typo in `benchmarks/hexdump.rb` (thanks ColMcp).
93
+ * Fixed a typo in Source URL, in the README (thanks Lawrence Woodman).
94
+ * Documented the `:endian` option for {Hexdump.dump}.
95
+ * Replaced ore-tasks with
96
+ [rubygems-tasks](https://github.com/postmodern/rubygems-tasks#readme).
97
+
1
98
  ### 0.2.1 / 2011-06-11
2
99
 
3
- * 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
4
101
  were not being cleared.
5
102
 
6
103
  ### 0.2.0 / 2011-06-11
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ gem 'rubygems-tasks', '~> 0.2'
8
+ gem 'rspec', '~> 3.0'
9
+ gem 'kramdown'
10
+ gem 'yard', '~> 0.9'
11
+ gem 'yard-spellcheck', require: false
12
+ end
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Hal Brodigan
1
+ Copyright (c) 2011-2021 Hal Brodigan
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
- # hexdump
1
+ # hexdump.rb
2
2
 
3
- * [Homepage](http://github.com/postmoderm/hexdump)
4
- * [Issues](http://github.com/postmoderm/hexdump/issues)
3
+ [![CI](https://github.com/postmodern/hexdump.rb/actions/workflows/ruby.yml/badge.svg)](https://github.com/postmodern/hexdump.rb/actions/workflows/ruby.yml)
4
+
5
+ * [Source](https://github.com/postmodern/hexdump.rb)
6
+ * [Issues](https://github.com/postmodern/hexdump.rb/issues)
5
7
  * [Documentation](http://rubydoc.info/gems/hexdump/frames)
6
- * [Email](mailto:postmodern.mod3 at gmail.com)
7
8
 
8
9
  ## Description
9
10
 
@@ -11,137 +12,508 @@ Simple and Fast hexdumping for Ruby.
11
12
 
12
13
  ## Features
13
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.
14
64
  * Can hexdump any Object supporting the `each_byte` method.
15
65
  * Can send the hexdump output to any Object supporting the `<<` method.
16
- * Can yield each line of hexdump, instead of printing the output.
17
- * Supports printing ASCII, hexadecimal, decimal, octal and binary bytes.
18
- * Supports hexdumping 1, 2, 4, 8 byte words.
19
- * Supports hexdumping Little and Big Endian words.
20
66
  * Makes {String}, {StringIO}, {IO}, {File} objects hexdumpable.
21
67
  * Fast-ish.
22
68
 
23
- ## Examples
24
-
25
- require 'hexdump'
26
-
27
- data = "hello\x00"
28
-
29
- Hexdump.dump(data)
30
- # 00000000 68 65 6c 6c 6f 00 |hello.|
31
-
32
- data.hexdump
33
- # 00000000 68 65 6c 6c 6f 00 |hello.|
34
-
35
- File.open('dump.txt','w') do |file|
36
- data.hexdump(:output => file)
37
- end
38
-
39
- # iterate over the hexdump lines
40
- data.hexdump do |index,hex,printable|
41
- index # => 0
42
- hex # => ["68", "65", "6c", "6c", "6f", "00"]
43
- printable # => ["h", "e", "l", "l", "o", "."]
44
- end
45
-
46
- # configure the width of the hexdump
47
- Hexdump.dump('A' * 30, :width => 10)
48
- # 00000000 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
49
- # 0000000a 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
50
- # 00000014 41 41 41 41 41 41 41 41 41 41 |AAAAAAAAAA|
51
-
52
- Hexdump.dump(data, :ascii => true)
53
- # 00000000 h e l l o 00 |hello.|
69
+ ## Install
54
70
 
55
- Hexdump.dump(data, :base => 16)
56
- # 00000000 68 65 6c 6c 6f 00 |hello.|
71
+ ```shell
72
+ $ gem install hexdump
73
+ ```
57
74
 
58
- Hexdump.dump(data, :base => :decimal)
59
- # 00000000 104 101 108 108 111 0 |hello.|
75
+ ### gemspec
60
76
 
61
- Hexdump.dump(data, :base => :octal)
62
- # 00000000 0150 0145 0154 0154 0157 0000 |hello.|
77
+ ```ruby
78
+ gem.add_dependency 'hexdump', '~> 1.0'
79
+ ```
63
80
 
64
- Hexdump.dump(data, :base => :binary)
65
- # 00000000 01101000 01100101 01101100 01101100 01101111 00000000 |hello.|
81
+ ### Gemfile
66
82
 
67
- ("ABC" * 10).hexdump(:word_size => 2)
68
- # 00000000 4241 4143 4342 4241 4143 4342 4241 4143 |䉁䅃䍂䉁䅃䍂䉁䅃|
69
- # 00000010 4342 4241 4143 4342 4241 4143 4342 |䍂䉁䅃䍂䉁䅃䍂|
83
+ ```ruby
84
+ gem 'hexdump', '~> 1.0'
85
+ ```
70
86
 
71
- ## Install
87
+ ## Examples
72
88
 
73
- $ gem install hexdump
89
+ ```ruby
90
+ require 'hexdump'
91
+
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
128
+
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
+ ```
74
314
 
75
315
  ## Benchmarks
76
316
 
77
- Benchmarks show {Hexdump.dump} processing 2.4M of data.
78
-
79
- ### Ruby 1.9.2-p180
80
-
81
- user system total real
82
- hexdump (block) 3.010000 0.010000 3.020000 ( 3.529396)
83
- hexdump 5.430000 0.030000 5.460000 ( 6.216174)
84
- hexdump width=256 (block) 3.010000 0.020000 3.030000 ( 3.308961)
85
- hexdump width=256 4.700000 0.040000 4.740000 ( 5.520189)
86
- hexdump ascii=true (block) 3.050000 0.010000 3.060000 ( 3.501436)
87
- hexdump ascii=true 5.450000 0.040000 5.490000 ( 6.352144)
88
- hexdump word_size=2 (block) 7.420000 0.050000 7.470000 ( 9.174734)
89
- hexdump word_size=2 9.500000 0.070000 9.570000 ( 11.228204)
90
- hexdump word_size=4 (block) 4.110000 0.030000 4.140000 ( 4.849785)
91
- hexdump word_size=4 5.380000 0.060000 5.440000 ( 6.209022)
92
- hexdump word_size=8 (block) 3.350000 0.070000 3.420000 ( 4.147304)
93
- hexdump word_size=8 4.430000 0.040000 4.470000 ( 5.930758)
94
-
95
- ### Ruby 1.8.7-p334
96
-
97
- user system total real
98
- hexdump (block) 8.470000 0.020000 8.490000 ( 9.585524)
99
- hexdump 11.080000 0.050000 11.130000 ( 12.542401)
100
- hexdump width=256 (block) 8.360000 0.030000 8.390000 ( 9.431877)
101
- hexdump width=256 10.310000 0.050000 10.360000 ( 12.278973)
102
- hexdump ascii=true (block) 8.550000 0.030000 8.580000 ( 10.502437)
103
- hexdump ascii=true 11.140000 0.040000 11.180000 ( 12.752712)
104
- hexdump word_size=2 (block) 12.680000 0.060000 12.740000 ( 14.657269)
105
- hexdump word_size=2 13.560000 0.080000 13.640000 ( 16.368675)
106
- hexdump word_size=4 (block) 8.500000 0.040000 8.540000 ( 9.687623)
107
- hexdump word_size=4 9.340000 0.040000 9.380000 ( 10.657158)
108
- hexdump word_size=8 (block) 7.520000 0.040000 7.560000 ( 8.565246)
109
- hexdump word_size=8 8.240000 0.040000 8.280000 ( 9.475693)
110
-
111
- ### JRuby 1.6.0
112
-
113
- user system total real
114
- hexdump (block) 6.742000 0.000000 6.742000 ( 6.495000)
115
- hexdump 7.498000 0.000000 7.498000 ( 7.498000)
116
- hexdump width=256 (block) 4.601000 0.000000 4.601000 ( 4.601000)
117
- hexdump width=256 5.569000 0.000000 5.569000 ( 5.569000)
118
- hexdump ascii=true (block) 5.198000 0.000000 5.198000 ( 5.198000)
119
- hexdump ascii=true 5.799000 0.000000 5.799000 ( 5.798000)
120
- hexdump word_size=2 (block) 8.440000 0.000000 8.440000 ( 8.440000)
121
- hexdump word_size=2 8.698000 0.000000 8.698000 ( 8.698000)
122
- hexdump word_size=4 (block) 5.603000 0.000000 5.603000 ( 5.602000)
123
- hexdump word_size=4 5.999000 0.000000 5.999000 ( 5.999000)
124
- hexdump word_size=8 (block) 7.975000 0.000000 7.975000 ( 7.975000)
125
- hexdump word_size=8 5.255000 0.000000 5.255000 ( 5.255000)
126
-
127
- ### Rubinius 1.2.4
128
-
129
- user system total real
130
- hexdump (block) 5.064230 0.029996 5.094226 ( 6.236865)
131
- hexdump 7.401875 0.039993 7.441868 ( 10.154394)
132
- hexdump width=256 (block) 4.149369 0.054992 4.204361 ( 6.518306)
133
- hexdump width=256 4.960246 0.089986 5.050232 ( 8.647516)
134
- hexdump ascii=true (block) 4.458322 0.026996 4.485318 ( 5.570982)
135
- hexdump ascii=true 6.961941 0.056992 7.018933 ( 9.895088)
136
- hexdump word_size=2 (block) 8.856653 0.078988 8.935641 ( 11.226360)
137
- hexdump word_size=2 10.489405 0.083988 10.573393 ( 12.980509)
138
- hexdump word_size=4 (block) 4.848263 0.047992 4.896255 ( 6.526478)
139
- hexdump word_size=4 6.649989 0.053992 6.703981 ( 8.245247)
140
- hexdump word_size=8 (block) 5.638143 0.047993 5.686136 ( 12.530454)
141
- hexdump word_size=8 7.598844 0.066990 7.665834 ( 16.881667)
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)
513
+ ```
142
514
 
143
515
  ## Copyright
144
516
 
145
- Copyright (c) 2011 Hal Brodigan
517
+ Copyright (c) 2011-2021 Hal Brodigan
146
518
 
147
519
  See {file:LICENSE.txt} for details.