1VANITYHASH(1) VANITYHASH(1)
2
3
4
6 vanityhash - A hex hash fragment creation tool
7
9 vanityhash [ options ] hexfragment < inputfile
10
11 vanityhash --append [ options ] hexfragment < inputfile > outputfile
12
14 vanityhash is a tool that can discover data to be added to the end of a
15 file to produce a desired hex hash fragment. It searches a message
16 space and runs a hashing algorithm against the original data plus the
17 appended data to determine if the desired hash fragment is present.
18 vanityhash can run multiple parallel workers to effectively make use of
19 multiple processors/cores/threads, and supports multiple hash digest
20 types (MD5, SHA1, SHA256, etc).
21
22 vanityhash can be used to append data to files that are capable of
23 ignoring garbage data at the end of the file (such as ISO images and
24 some types of graphic images), in order to produce a "vanity" hash.
25 vanityhash is fast, as it only reads the base input data once, and then
26 reverts back to that base state over and over while it permeates the
27 search space, rather than hashing the entire source during each
28 permeation.
29
30 vanityhash operates on the concept of a "search space". For example,
31 given a 24-bit search space, vanityhash will run from 0x00000000 to
32 0x00ffffff, append the 4-byte packed version of each number to the end
33 of the input data, calculate the resulting hash, and search the hash
34 value for the desired hex fragment pattern. A desired hex fragment can
35 be larger than the search space (for example, searching for "abcdef" in
36 a 16-bit search space), but the chances of finding a match reduce
37 drastically the larger the desired hex fragment is.
38
39 In its default operation, vanityhash will search the entire specified
40 search space and output all matching results to STDOUT, one result per
41 line, in the form "extradata hash", where both "extradata" and "hash"
42 are in hex form. When the --append option is specified, this behavior
43 changes. If a match is found, the original input data plus the extra
44 data (in byte form) are outputted, and searching ends after the first
45 successful match. If no matches are found, the original data only is
46 outputted.
47
49 -b bits, --bits=bits
50 Space to be searched, in bits. Allowed values range from 1 to 64.
51 Default is 24. Search spaces larger than 32 bits require a 64-bit
52 operating system, and a version of Perl compiled with 64-bit
53 integer support.
54
55 -p position, --position=position
56 The position within the hex hash to look for the desired fragment,
57 in hex digits. The beginning starts at 0. Default is 0. A
58 position that extends the fragment beyond the length of the hash is
59 not allowed.
60
61 -y, --any-position
62 When enabled, this option will override --position and will return
63 hashes that contain the desired fragment in any position within the
64 hash.
65
66 -s seconds, --progress=seconds
67 The number of seconds between printing of progress lines, default 5
68 seconds. A decimal value may be specified. A value of 0 disabled
69 printing progress lines.
70
71 -w workers, --workers=workers
72 The number of workers to be spawned. Default is 1. Recommended
73 value is the number of logical processors on the running system.
74
75 -d digesttype, --digest=digesttype
76 The hashing digest type to use. Default is "md5" Allowed values
77 are "md2", "md4", "md5", and "shaN" where N is a valid SHA digest
78 value. "sha1alt" is accepted to use Digest::SHA1 instead of
79 Digest::SHA. Note that for many digest types, the appropriate Perl
80 module must be installed and available.
81
82 -a, --append
83 When enabled, the original data is outputted back to STDOUT. Then,
84 when/if the first matching hash is found, the data fragment used to
85 produce the matching hash is outputted to STDOUT. STDOUT can then
86 be redirected to another file to produce the modified file.
87
88 -q, --quiet
89 Normally vanityhash sends a fair amount of status information to
90 STDERR during operation. When enabled, all non-error status
91 information is instead suppressed.
92
93 -?, --help
94 Print a synposis and exit.
95
97 Search spaces larger than 32 bits require a 64-bit operating system,
98 and a version of Perl compiled with 64-bit integer support.
99
100 A block of computed data is added equal to the size of the integer type
101 the search space fits into (1 byte for 8 bits or less, 2 bytes for 9
102 through 16 bits, 4 bytes for 17 through 32 bits, 8 bytes for 33 through
103 64 bits), even if the search space could fit into a smaller raw byte
104 block (say, 3 bytes for a 20-bit search space). While this does not
105 reduce (or increase) the possibility of finding a match in a given
106 search space, the extra null byte(s) in the block are technically
107 wasteful.
108
109 Extra bytes are packed according to system endianness. Thus, search
110 results will be different between big and little endian systems.
111
112 vanityhash should work fine on any POSIX operating system, and has been
113 tested on Linux and Mac OS X. It mostly works with Strawberry Perl for
114 Windows, but crashes at the end. Suggestions to fix this would be
115 welcomed.
116
118 vanityhash was written by Ryan Finnie <ryan@finnie.org>. vanityhash
119 was inspired by Seth David Schoen's 2003 program, hash_search.
120
121
122
123 2010-12-11 VANITYHASH(1)