summaryrefslogtreecommitdiff
path: root/crypto.py
diff options
context:
space:
mode:
Diffstat (limited to 'crypto.py')
-rw-r--r--crypto.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto.py b/crypto.py
index 76a7265..494ce04 100644
--- a/crypto.py
+++ b/crypto.py
@@ -82,9 +82,9 @@ class Crypto:
return Crypto.unpad([pow(Crypto.b2i(c), d, n) for c in p], bits)
def keygen(bits=2048):
- #p, q = Crypto.pgen(bits >> 1), Crypto.pgen(bits >> 1)
- p = 24255437060933278568327701135893465111281929996020213283563016322587538898307222832676648856557095025772204413206980826822975131457046546497523091381599846376591186469347076218208800469787851326371447052505831886762813382071182380079565671280034572474822918684998169291052805586193101619898239325398349038870346792747848088462443207267957917761324031277878527517794286421236832567949642803568424614512153948596887559236723641422745633542467824845355764889656771928727895545492980157734692593529905622895318376798465152794082339714326113478586369772394086511968434509576965140800722212375216417198365996986997884522143
- q = 19768976408982925938974295924028441291658237346176654371253117928175549332214544184956873153703986985390178340362842925095394171723247001148381841608957916206559941167745803865591902614480793421765383057879093169950619962622549993022767924551441062799960937735273562540998394372954466434657886766982923637838307867760458002688852634523140205959841808840422174672818444274740218202285908370264201317843186892579386846520240651724201292430263438230872027782342582077071631797326347450149692183612550505452085046398227369191676244454566325746209776357595496074364519226187538979254031364601406997434831185228055585873117
+ p, q = Crypto.pgen(bits >> 1), Crypto.pgen(bits >> 1)
+ #p = 24255437060933278568327701135893465111281929996020213283563016322587538898307222832676648856557095025772204413206980826822975131457046546497523091381599846376591186469347076218208800469787851326371447052505831886762813382071182380079565671280034572474822918684998169291052805586193101619898239325398349038870346792747848088462443207267957917761324031277878527517794286421236832567949642803568424614512153948596887559236723641422745633542467824845355764889656771928727895545492980157734692593529905622895318376798465152794082339714326113478586369772394086511968434509576965140800722212375216417198365996986997884522143
+ #q = 19768976408982925938974295924028441291658237346176654371253117928175549332214544184956873153703986985390178340362842925095394171723247001148381841608957916206559941167745803865591902614480793421765383057879093169950619962622549993022767924551441062799960937735273562540998394372954466434657886766982923637838307867760458002688852634523140205959841808840422174672818444274740218202285908370264201317843186892579386846520240651724201292430263438230872027782342582077071631797326347450149692183612550505452085046398227369191676244454566325746209776357595496074364519226187538979254031364601406997434831185228055585873117
n, e, d = p*q, Crypto.exp, pow(Crypto.exp, -1, (p-1)*(q-1))
return p, q, n, e, d
@@ -102,7 +102,6 @@ class PKSock:
self.iskp = 0
self.osk = None
self.oskp = 0
- # TODO: shrink sksz by random pad size so it's only 1 chunk lol
self.sksz = self.nbytes - self.headsz - Crypto.rand_pad - 1
self.read_buffer = False
self.buffer = b''
@@ -178,7 +177,6 @@ class PKSock:
if not self.isk or self.iskp >= len(self.isk):
self.pull_sk()
# TODO: this could use some work because we can split opcodes etc
- # TODO: this also bricks if we pull the key successfully
c = self.raw_recv(len(self.isk) - self.iskp)
self.raw_cache(c)
k = self.isk[self.iskp : self.iskp+len(c)]