You can put it in pywallet (or jeeq or jasvet, I don't really know which one have the correct classes. PM me if you want to test)
You just need to change pvk1 and pattern
#### On A's computer
pvk1=2142
key=EC_KEY(pvk1)
print 'Hidden pvk1: %d'%pvk1
print 'pbk1 X: ', key.pubkey.point.x()
print 'pbk1 Y: ', key.pubkey.point.y()
#### B receives X and Y and puts them in pbk2
pbk2=key.pubkey.point
pvk2=0
pattern='1BTC'
print 'Pattern: '+pattern
while True:
pvk2+=1
pbk2=pbk2.__add__(key.generator)
if verbose:
print 'Partial private key pvk2=%d'%pvk2
print 'pbk2 X: ', pbk2.x()
print 'pbk2 Y: ', pbk2.y()
print 'pbk2 compressed addr: ', pbk2.get_addr(True)
print 'pbk2 uncompressed addr: ', pbk2.get_addr(False)
if pbk2.get_addr(True)[:len(pattern)]==pattern:
break
if pbk2.get_addr(False)[:len(pattern)]==pattern:
break
#### B sends pvk2 to A
finalpvk=pvk1+pvk2
print 'My hidden pvk1: %d'%pvk1
print 'Received pvk2: %d'%pvk2
print 'Final pvk: %d'%finalpvk
key=EC_KEY(finalpvk)
if key.pubkey.point.get_addr(True)[:len(pattern)]==pattern:
print 'BitcoinAddress(pvk=%d, compressed=True) ='%finalpvk, key.pubkey.point.get_addr(True)
elif key.pubkey.point.get_addr(False)[:len(pattern)]==pattern:
print 'BitcoinAddress(pvk=%d, compressed=False) ='%finalpvk, key.pubkey.point.get_addr(False)
else:
print "pvk2 doesn't work"
For pvk=2142 and pattern='1jj'
pbk1 X: 65150968730280697562609886764166998172449505192100168981244287450372694995242
pbk1 Y: 71888227149264242494450017634314194438151153455233498547016746414353185433649
Pattern: 1jj
My hidden pvk1: 2142
Received pvk2: 2570
Final pvk: 4712
BitcoinAddress(pvk=4712, compressed=True) = 1jjenYCokb9eHC2Sg82Q13dyY6YHb3BRX
For pvk=2142 and pattern='1BTC'
pbk1 X: 65150968730280697562609886764166998172449505192100168981244287450372694995242
pbk1 Y: 71888227149264242494450017634314194438151153455233498547016746414353185433649
Pattern: 1BTC
My hidden pvk1: 2142
Received pvk2: 35640
Final pvk: 37782
BitcoinAddress(pvk=37782, compressed=False) = 1BTCHcadnBqGqCRco6vDyMpm5KMN16QT6e