for x in range(1,65536):
f= (ters(pub,x))
data= open(“halfpub.txt”,”a”)
data.write(f+”\n”)
data.close()
It seems I was using ice secp256k1 files from 2022, after downloading the latest one from github I managed to get it running, but first public key I provided the script only generated 780 keys and returned error no 13, permission denied to open the txt file, my second attempt with another key generated 65535 keys and stopped, now what happened with the first run, why would it want to open the txt file?
Btw, how can I change the number of subtraction? For example which ones should I change if I wanted to subtract 50 instead of 1 and then divide?
k=mod_inverse(2,N)
neg1=ice.point_negation(ice.scalar_multiplication(1))
def ters(Qx,Scalar):
ScalarBin = str(bin(Scalar))[2:]
le=len(ScalarBin)
for i in range (1,le+1):
if ScalarBin[le-i] == "0":
Qx=ice.point_multiplication(k,Qx)
else:
Qx=ice.point_addition(Qx,neg1)
Qx=ice.point_multiplication(k,Qx)
return ice.point_to_cpub(Qx)
Should I replace all 1s with 50? Lol, I'm noob.
Your help is appreciated.👍
2nd edit:
A hint for interested parties, 2^255, find it's associated private key and double it mod n. Cheers. 😉
1-this is the script of a simple consecutive subtraction.
target =1361123746758658236458661571245234340160
#target_pub= "023d62d9d64a7164a2ae6f0561f7e8317e69b4a1ee61048fe768a1316b39b1d3a7"
for i in range (1,3):
h = int(str(i)+"000000000000000000000000000000000000000")
b = (target - h)
print(b)
data = open("sustract.txt","a")
data.write(str(i)+"= "+str(b)+"\n")
data.close()
data open, python creates a text file if it doesn't exist where the results are saved.
maybe you have to grant write permissions.
run cmd as administrator.
for Na in range(start,end):
1,2,3,4,5,6,7,8,9,10
I use it for the number of successive subtractions.
h = int(str(i)+"000000000000000000000000000000000000000")
str(i)+"000000000000000000000000000000000000000")
# str(i)
It will be replaced according to the sequence in the range, the heap of zero will be added at the end, this to automate the amount to be subtracted like:
1000000000000000000000000000000000000000
2000000000000000000000000000000000000000
3000000000000000000000000000000000000000
4000000000000000000000000000000000000000
2-this script is the same but using pubkeys.
import secp256k1 as ice
target_public_key = "023d62d9d64a7164a2ae6f0561f7e8317e69b4a1ee61048fe768a1316b39b1d3a7"
target_upub = ice.pub2upub(target_public_key)
for i in range (1, 11):
char1 = int(str(i)+"000000000000000000000000000000000000000")
pubchar1 = ice.scalar_multiplication(char1)
resultx= ice.point_subtraction(target_upub, pubchar1)
resultmut=resultx.hex()
fh=ice.to_cpub(resultmut)
f=(str(i)+"="+fh)
print(f)
data = open("subtractpub.txt","a")
data.write(f+"\n")
data.close()
3-this script subtracts the custom amount, 9999 times.
change the range to your liking.
the amount to subtract (b1) you customize according to your pubkey
import secp256k1 as ice
target_public_key = "023d62d9d64a7164a2ae6f0561f7e8317e69b4a1ee61048fe768a1316b39b1d3a7"
f = ice.pub2upub(target_public_key).hex()
for i in range (10000):
#B1= amount subtracted every round
B1= 10000000000000000000000000000000000000
B= ice.scalar_multiplication(B1)
A=[]
A.append(f)
o=str(A)[2:-2]
T=ice.to_cpub(o)
upub= ice.pub2upub(o)
f = ice.point_subtraction(upub, B).hex()
A.append(f)
fh2=ice.to_cpub(f)
pubstart= fh2
fin=(str(i)+"="+str(fh2))
print(fin)
data = open("sustract-x.txt","a")
data.write(fin+"\n")
data.close()
Example if you are looking for a pub in a range: 10000:20000
you could choose b1= 100 and for i in range (201)
This would subtract 100 in 100, 200 times from your target.
5- another form of successive subtraction
import secp256k1 as ice
target_public_key = "023d62d9d64a7164a2ae6f0561f7e8317e69b4a1ee61048fe768a1316b39b1d3a7"
target = ice.pub2upub(target_public_key)
num = 10 # number of times.
sustract= 1000 #amount to subtract each time.
sustract_pub= ice.scalar_multiplication(sustract)
res= ice.point_loop_subtraction(num, target, sustract_pub).hex()
print(res)