Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit11bf332

Browse files
yjqiangsybrenstuvel
yjqiang
authored andcommitted
speedup
"if A and B" if mostly A is True then we should judge B at first
1 parent7619f14 commit11bf332

File tree

6 files changed

+6
-6
lines changed

6 files changed

+6
-6
lines changed

‎rsa/key.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ def newkeys(nbits, accurate=True, poolsize=1, exponent=DEFAULT_EXPONENT):
783783
iffailures:
784784
break
785785

786-
if (countandcount%10==0)orcount==1:
786+
if (count%10==0andcount)orcount==1:
787787
print('%i times'%count)
788788
exceptKeyboardInterrupt:
789789
print('Aborted')

‎rsa/parallel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def getprime(nbits, poolsize):
9595
iffailures:
9696
break
9797

98-
ifcountandcount%10==0:
98+
ifcount%10==0andcount:
9999
print('%i times'%count)
100100

101101
print('Doctests done')

‎rsa/pkcs1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def _find_method_hash(clearsig):
433433
iffailures:
434434
break
435435

436-
ifcountandcount%100==0:
436+
ifcount%100==0andcount:
437437
print('%i times'%count)
438438

439439
print('Doctests done')

‎rsa/pkcs1_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ def mgf1(seed, length, hasher='SHA-1'):
9797
iffailures:
9898
break
9999

100-
ifcountandcount%100==0:
100+
ifcount%100==0andcount:
101101
print('%i times'%count)
102102

103103
print('Doctests done')

‎rsa/prime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ def are_relatively_prime(a, b):
195195
iffailures:
196196
break
197197

198-
ifcountandcount%100==0:
198+
ifcount%100==0andcount:
199199
print('%i times'%count)
200200

201201
print('Doctests done')

‎rsa/randnum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def randint(maxvalue):
8888
ifvalue<=maxvalue:
8989
break
9090

91-
iftriesandtries%10==0:
91+
iftries%10==0andtries:
9292
# After a lot of tries to get the right number of bits but still
9393
# smaller than maxvalue, decrease the number of bits by 1. That'll
9494
# dramatically increase the chances to get a large enough number.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp