Array
Pattern
Pattern create
Assume the pattern length = 500, You can change it to any value. By default this will create 20280 probabilities max.
pattern_create = ('Aa0'..'Zz9').to_a.join.each_char.first(500).join
In case you need longer pattern(ex. 30000) you can do the following
pattern_create = ('Aa0'..'Zz9').to_a.join
pattern_create = pattern_create * (30000 / 20280.to_f).ceil
Pattern offset
I'll assume the pattern was equal or less than “20280” and we are looking for “9Ak0” pattern characters. The pattern_create should be initialized from above
pattern_offset = pattern_create.enum_for(:scan , '9Ak0').map {Regexp.last_match.begin(0)}
Note: This does not consider the little endian format, for that there is extra code should be written. For more info, please take a look on the following code.
Generate all hexadecimal values from \x00
to \xff
puts (0..255).map {|b| ('\x%02X' % b)}
Notes:
- To change value presentation from
\xea
to0xea
, change\x%x
to0x%x
- To Make all letters capital (
\xea
to\xEA
) , change\x%x
to\x%X
Generate all Printable Characters
(32..126).map {|c| c.chr}
short and unclean
(32..126).map &:chr