What does masked with leading 000...0001 to set difficulty mean? I mean how would someone add that to a program?
It means they were able to set the bit range "difficulty" by masking the leading characters of the private key.
JLPs Kangaroo program does it like this:
if(dpSize > 256) dpSize = 256;
dMask = (1ULL << (256 - dpSize)) - 1;
dMask = ~dMask;
Now that is for distinguished points, but the concept is the same.
So if you run a -dp of say 40, then the leading 10 characters (of the xpoint) would be 0s (zeros). I imagine it would be easy to implement something similar in wallet software or a script to generate private keys, and change the masking to mask the leading characters of the private key.