warner/wireguard-vanity-address

Support Regex

zmcandee opened this issue · 1 comments

Adding support for regex would allow more control over the names you are looking for as well as looking for multiple names at once. The speed cost of RE.is_match() is negligible when you consider the ability to look for multiple names, include number substitutions and incorporate the --in argument.

Regex example matching 72 derivatives of stew+ and 48 derivatives of nancy in the first 10 characters:
^.{0,5}[sS][tT7][eE3][wW][/+]|^.{0,5}[nN][aA4][nN][cC][yY]

I like that idea, maybe a --regex= argument which gives you exact control over the matching predicate.

I bet we'd have to give up the yield estimator, though (the code that figures the probability that a random address will meet the criteria, then multiplies that by the measured rate of generation, to give you an idea how how frequently it will emit matching addresses). I know how to calculate the yield with a simple prefix, and I know how to estimate the effect of allowing it to appear within a prefix, but I don't know how to take a generalized regexp and turn it into a ratio. But I think this feature would be great to have even without the estimator.