Created
July 5, 2011 17:06
-
-
Save pquerna/1065291 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socket import gethostname | |
import time | |
from cloudkick.ckcrypto import secure_hash | |
_prefix = "&rh=%s&h=%s" % (secure_hash(4), gethostname()) | |
def txnId(count=0): | |
global _prefix | |
t = int(time.time()) | |
a = chr((t >> 24) & 0xFF ) + chr((t >> 16) & 0xFF) + chr((t >> 8) & 0xFF) + chr(t & 0xFF) | |
return _prefix + "&r=" + secure_hash(8) + "&ts=" + a.encode('base64')[:6] + "&c=" + str(count) | |
print txnId() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment