vanityhash is a tool that can discover data to be added to the end of a file to produce a desired hex hash fragment. It searches a message space and runs a hashing algorithm against the original data plus the appended data to determine if the desired hash fragment is present. vanityhash can run multiple parallel workers to effectively make use of multiple processors/cores/threads, and supports multiple hash digest types (MD5, SHA1, SHA256, etc).
vanityhash is fast on modern hardware. An Intel Core i7 920 running 8 workers can search a 24-bit MD5 space (performing nearly 17 million checksums) in approximately 12 seconds, and can search a 32-bit MD5 space (performing nearly 4.3 billion checksums) in less than an hour. (Searching a 64-bit MD5 space will take approximately 1 million years, and has not yet been attempted for obvious reasons.) For more information, see Performance, below.
vanityhash should work on any POSIX operating system with Perl 5.8.0 or later. It has been tested on Linux, FreeBSD, and Mac OS X.
user@host:~$ vanityhash -w 8 face99 <input.iso Reading input data and adding to digest...done. Original data: 131024900 bytes, MD5 f100ffa1d470b7d119979c58f18bb6b1 Searching for face99 at position 0 in a 24-bit space. Spawning 8 workers... done. Match found: 0xe2b31a00 -> MD5 face99dd5fccfd85035c333828baa0e5 e2b31a00 face99dd5fccfd85035c333828baa0e5 Match found: 0x54382000 -> MD5 face999e4ace0f3feaf9bac5f1655609 54382000 face999e4ace0f3feaf9bac5f1655609 38% searched, ~00:08 remaining... 78% searched, ~00:02 remaining... Search finished in 00:12, 2 matches found in 100% of a 24-bit space. user@host:~$ vanityhash -a -w 8 face99 <input.iso >vanity.iso Reading input data and adding to digest...done. Original data: 131024900 bytes, MD5 f100ffa1d470b7d119979c58f18bb6b1 Searching for face99 at position 0 in a 24-bit space. Spawning 8 workers... done. Match found: 0xe2b31a00 -> MD5 face99dd5fccfd85035c333828baa0e5 Search finished in 00:01, 1 match found in 10% of a 24-bit space. user@host:~$ ls -la vanity.iso -rw-r--r-- 1 user users 131024904 2010-12-11 03:05 vanity.iso user@host:~$ md5sum vanity.iso face99dd5fccfd85035c333828baa0e5 vanity.iso user@host:~$ █
The following table lists vanityhash execution times for a variety of platforms. All tests were performed with default MD5 hashing. The original data used in the MD5 hash is not relevant, as the original data is only hashed once in the stream, and is not included in the time calculations. Approximate times (indicated by "~") are estimates reported by vanityhash for tests that were not completed. Non-approximate times are actual values recorded during the test. 64-bit tests were only performed on 64-bit operating systems, when available.
Search spaces of 32 bits or less are faster on a 64-bit operating system, but only marginally. Running more workers than the number of logical processors on the system is slower than if you use exactly the number of workers as logical processors. This is because, once the workers are spawned, the workers are 100% CPU bound, and there is no disk IO utilized after the initial read of the input data.
System | OS | Workers | 16-bit | 24-bit | 32-bit | 64-bit |
---|---|---|---|---|---|---|
Intel Core i7 920 6 | Linux, 32-bit | 8 | 00:00 | 00:12 | 51:12 | N/A |
Intel Xeon E5520 1 | Linux, 64-bit | 2 | 00:00 | 00:30 | ~02:10:30 | ~1,087,982y 235d 00:10:03 |
Intel Xeon E5520 1 | Linux, 32-bit | 2 | 00:00 | 00:31 | ~02:15:21 | N/A |
Intel Xeon 5150 2 | OS X, 64-bit | 4 | 00:00 | 00:26 | ~01:51:51 | ~943,595y 334d 19:11:36 |
Intel Celeron 1.3GHz | Linux, 32-bit | 1 | 00:01 | 04:21 | ~18:51:06 | N/A |
PowerPC G4 1.25GHz 5 | Linux, 32-bit | 1 | 00:01 | 05:10 | ~22:23:17 | N/A |
Sun UltraSPARC IIe 500MHz 4 | Linux, 32-bit | 1 | 00:08 | ~33:35 | ~5d 12:04:08 | N/A |
AMD K6 300MHz | Linux, 32-bit | 1 | 00:08 | ~36:32 | ~6d 05:26:25 | N/A |
Intel XScale IXP420 266MHz 3 | Linux, 32-bit | 1 | 00:24 | ~02:20:15 | ~18d 16:08:59 | N/A |
vanityhash is licensed under the GNU General Public License v2.0.
vanityhash, a hex hash fragment creation tool
Copyright (C) 2010 Ryan FinnieThis program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
vanityhash was written by Ryan Finnie. vanityhash was inspired by Seth David Schoen's 2003 program, hash_search
.