Skip to content

Commit

Permalink
Insecure compile-time randomness constant.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed May 17, 2021
1 parent 6dba221 commit 99dd573
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Compiler/permutation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from random import randint
from random import Random
import math

#import sys
Expand All @@ -11,6 +11,7 @@
_Array = Array

SORT_BITS = []
insecure_random = Random(0)

def predefined_comparator(x, y):
""" Assumes SORT_BITS is populated with the required sorting network bits """
Expand Down Expand Up @@ -139,7 +140,7 @@ def random_perm(n):
'use --insecure to activate')
a = list(range(n))
for i in range(n-1, 0, -1):
j = randint(0, i)
j = insecure_random.randint(0, i)
t = a[i]
a[i] = a[j]
a[j] = t
Expand Down

0 comments on commit 99dd573

Please sign in to comment.