def new_cid(): """ Returns a new 128-bit correlation identifier. It's *not* safe to use the ID for any cryptographical purposes, it's only meant to be used as a conveniently formatted ticket attached to each of the requests processed by Zato servers. Changed in 1.2: The number is now 28 characters long not 40, like in previous versions. """ # The number below (27) needs to be kept in sync with zato.common.log_message.CID_LENGTH. # There is nothing special in the 'K' prefix, it's just so that a CID always # begins with a letter and 'K' seems like something # that can't be taken for some other ASCII letter (e.g. is it Z or 2 etc.) return 'K{0:0>27}'.format(b32_crockford_encode(getrandbits(128)))
def new_cid(): """ Returns a new 128-bit correlation identifier. It's *not* safe to use the ID for any cryptographical purposes, it's only meant to be used as a conveniently formatted ticket attached to each of the requests processed by Zato servers. Changed in 2.0: The number is now 28 characters long not 40, like in previous versions. """ # The number below (27) needs to be kept in sync with zato.common.log_message.CID_LENGTH. # There is nothing special in the 'K' prefix, it's just so that a CID always # begins with a letter and 'K' seems like something # that can't be taken for some other ASCII letter (e.g. is it Z or 2 etc.) return 'K{0:0>27}'.format(b32_crockford_encode(getrandbits(127) + (1 << 127)))