How does vanitygen calculate difficulty?

4

It seems really random. 1d is 1353, 1L is 22, 11 is 256, 11L is 78508, 11x is 78508, 111 is 65536, 112 is is 1335, 113 is 1330, 114 is 1330, 1L1 is 1330. I thought it was 58 to the power of the number of digits. Why isn't it?

lurf jurv

Posted 2013-04-09T14:41:05.323

Reputation: 2 516

Answers

5

There are two parts to this.

First is leading 1s. A leading 1 represents a 0 byte i.e. 8 bits. This means that for every additional 1 you prefix your search string with the difficulty increases by 256 (2^8). You can see this easily by checking the difficulty of prefixes 1, 11, 111 etc.

Second is other characters. Here the difficulty changes depending on how many bits you are specifying, because as your value is converted from base58 to an integer value and from there to a power of 2. Depending on your second number in your 2-digit prefix the difficulty will move around a bit (plus there will be rounding errors). Again, easy to see with prefixes of 12 and 1z (which are 1 and 57 in base58 encoding, respectively).

Once you get past all of that you should find that your 58 to the power of the number of digits comes in to play. For example the difficulty of 1234 should be 58 times the difficulty of 123.

jgm

Posted 2013-04-09T14:41:05.323

Reputation: 1 487

"For example the difficulty of 1234 should be 58 times the difficulty of 123." It's not. 1353 * 58 != 78508. Even if you compare 12345678 and 123456789, you'll find it's not exactly a factor of 58

Nick ODell 2013-04-09T23:37:11.273

As mentioned, there are rounding errors because difficulties are calculated using integer values (and the calculation multiplies integers so the error compounds as you increase the size of the prefix).jgm 2013-04-09T23:54:56.880

Ah. So the difficulty reported by vanitygen is inaccurate?Nick ODell 2013-04-09T23:56:16.597

I wouldn't label it as inaccurate; it's a minor rounding error that's less than 0.05% in the most egregious case, and that's only when it really doesn't matter because the absolute numbers are so small.jgm 2013-04-10T00:01:24.987

Also, why is 1m (non-case sensitive) the same difficulty as 1L?lurf jurv 2013-04-10T20:35:12.060

Because 1M is the same difficulty as 1L.jgm 2013-04-11T13:22:54.693

1Non case sensitive. It says that the probability of finding 1L is the same as finding 1m OR 1M. That seems a little odd to me.lurf jurv 2013-04-23T14:39:43.117