Spaces:
Sleeping
Sleeping
Ahmad Hammoudeh
commited on
Commit
·
18aa8c9
1
Parent(s):
22af54c
Update msg_encX.py
Browse files- msg_encX.py +4 -0
msg_encX.py
CHANGED
|
@@ -15,6 +15,7 @@ encryption_difficulty0 = int(os.environ['encryption_difficulty'])
|
|
| 15 |
N_days0=int(os.environ['N_days'])
|
| 16 |
User_passcode0=int(os.environ['User_passcode'])
|
| 17 |
power0 = float(os.environ['power'])
|
|
|
|
| 18 |
|
| 19 |
def seedx(path , User_passcode=User_passcode0, N_days=N_days0, encryption_difficulty = encryption_difficulty0):
|
| 20 |
try:
|
|
@@ -23,6 +24,7 @@ def seedx(path , User_passcode=User_passcode0, N_days=N_days0, encryption_diffic
|
|
| 23 |
except:
|
| 24 |
old_day_index = 0
|
| 25 |
print('no old index was found')
|
|
|
|
| 26 |
timestamp = datetime.timestamp(datetime.now())
|
| 27 |
#total number of days since unix time
|
| 28 |
days_span = timestamp/math.factorial(6)/120 + 0.1#*random.random() #first time calculate the days since unix, thae latter randomize the time zone by up to ~7 hours
|
|
@@ -38,6 +40,8 @@ def seedx(path , User_passcode=User_passcode0, N_days=N_days0, encryption_diffic
|
|
| 38 |
else:
|
| 39 |
publicKey, privateKey = rsa.newkeys(encryption_difficulty)
|
| 40 |
old_day_index = day_index
|
|
|
|
|
|
|
| 41 |
#save in a folder
|
| 42 |
with open(path +'indx.txt', 'w') as f:
|
| 43 |
f.write(str(old_day_index))
|
|
|
|
| 15 |
N_days0=int(os.environ['N_days'])
|
| 16 |
User_passcode0=int(os.environ['User_passcode'])
|
| 17 |
power0 = float(os.environ['power'])
|
| 18 |
+
#publicKey0 = int(os.environ['publicKey'])
|
| 19 |
|
| 20 |
def seedx(path , User_passcode=User_passcode0, N_days=N_days0, encryption_difficulty = encryption_difficulty0):
|
| 21 |
try:
|
|
|
|
| 24 |
except:
|
| 25 |
old_day_index = 0
|
| 26 |
print('no old index was found')
|
| 27 |
+
os.environ['old_day_index'] = old_day_index
|
| 28 |
timestamp = datetime.timestamp(datetime.now())
|
| 29 |
#total number of days since unix time
|
| 30 |
days_span = timestamp/math.factorial(6)/120 + 0.1#*random.random() #first time calculate the days since unix, thae latter randomize the time zone by up to ~7 hours
|
|
|
|
| 40 |
else:
|
| 41 |
publicKey, privateKey = rsa.newkeys(encryption_difficulty)
|
| 42 |
old_day_index = day_index
|
| 43 |
+
os.environ['publicKey'] = publicKey
|
| 44 |
+
os.environ['old_day_index'] = old_day_index
|
| 45 |
#save in a folder
|
| 46 |
with open(path +'indx.txt', 'w') as f:
|
| 47 |
f.write(str(old_day_index))
|