I\'m working on an online event ticketing system, where users will be able to self print his tickets and show up at the event where it will be scanned (barcode) and ideally
Why reinvent the wheel? Just do something like this (Python Code, ask me if you need clarification):
import hashlib
secretpassword = "blah"
def createticket(eventnum, ticketnum):
m = hashlib.md5() # or any crypto hash you like
m.update("%s%s%s" % (eventnum, ticketnum, secretpassword))
return m.hexdigest()[:10]
Example:
Event Number 1
Ticket Number 123
createticket(1,123)
# output: 2d7f242597
Mr ticketman comes around with his verifier and enters in the event/ticket number and the hash:
def verifier(eventnum, ticketnum, hash):
return hash == createticket(eventnum, ticketnum)
verifier(1,123, "2d7f242597")
# ouput: True