Skip to content

Commit e0d129b

Browse files
committed
Modified keygen.py to output different filenames and parameters
Modified sqrt_digits.py to add ability to do scalar multiplication New json files are output keys
1 parent d9634b7 commit e0d129b

File tree

7 files changed

+22
-3
lines changed

7 files changed

+22
-3
lines changed

keygen.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,18 @@ def convertbase26(data):
2727
output = output[::-1]
2828
return output
2929

30-
def writejson(obj,fname="testkeygen3.json"):
30+
def writejson(obj,fname="testkeyfinal.json"):
3131
with open(fname,"w") as f:
3232
json.dump(obj,f)
3333

3434
if __name__=="__main__":
3535
sequences = (
3636
"coprime-digits-mod10-2023-1000k.json",
3737
"pi-digits.json",
38-
#"sqrt-2-1000000dp.json"
38+
#"sqrt-2-1000000dp.json",
39+
"sqrt-2-factor3.json"
3940
)
4041
data = loadkeysbase10(sequences,length=1000000)
42+
#writejson(data,"testkeygenfinal-b10.json")
4143
data26 = convertbase26(data)
4244
writejson(data26)

sqrt-2-factor3.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

sqrt_digits.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ def square_rt(number,dp=10000):
1515
ans_lst.append(0)
1616
return ans_lst[:dp]
1717

18+
def scalar_mult(data,factor):
19+
output = []
20+
for i in data:
21+
output.append((i*factor)%10)
22+
return output
23+
24+
def write_json(data,fname):
25+
import json
26+
with open(fname,"w") as f:
27+
json.dump(data,f)
28+
1829
def write_sqrt(number,dp=10000):
1930
import json
2031
data = square_rt(number,dp)
@@ -24,4 +35,5 @@ def write_sqrt(number,dp=10000):
2435

2536
if __name__ == "__main__":
2637
#print(square_rt(2,1000))
27-
write_sqrt(2,1000000)
38+
#write_sqrt(2,1000000)
39+
write_json(scalar_mult(square_rt(2,1000000),3),"sqrt-2-factor3.json")

testkeyfinal.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

testkeygen3-b10.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

testkeygen3.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

testkeygenfinal-b10.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)