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
Here's a scheme that has the advantage of letting you calculate the next ticket hash from the previous (so you can verify whether one is missing), but doesn't let outsiders calculate the next one:
Ticket.0 = substring(HASH(SALT + IV ), 0, LENGTH)
Ticket.i = substring(HASH(SALT + Ticket.i-1), 0, LENGTH)
where
HASH
is any hashing function that distributes its entropy relatively evenly across the output stringSALT
is a constant you keep secret; it's a good idea to use a different one for each eventIV
is another constant you keep secret