What is the difference between this implementation of auth key generator in PHP:
<?php
$password = "834ff7b651a6cb1b2f39c70bf43d3e78";
$timestamp = round(microtime(true) * 1000);
$hash = md5($password.$timestamp);
echo "\n Timestamp: ".$timestamp;
echo "\n Hash: ".$hash."\n";
?>
and this one in python:
import hashlib
import time
import ipdb
import math
def microtime(get_as_float = False) :
if get_as_float:
return time.time()
else:
return '%f %d' % math.modf(time.time())
password = "834ff7b651a6cb1b2f39c70bf43d3e78"
timestamp = round(microtime(get_as_float=True)*1000)
m = hashlib.md5()
m.update(password + str(timestamp))
hash = m.hexdigest()
print(str(int(timestamp)))
print(hash)
If the timestamp generation works in PHP in another way than my implementation in Python?
Because I check it during the auth on the service which uses this timestamp in pair with hash calculated from password and timestamp concatenated together and in case with PHP I can pass, but in case with Python I cannot.
Thanks!