I need to create a token to appear on a querystring that can be passed to a web page and decoded in order to find a record in a database view.
The token should not be vulnerable to brute force incrementing value type attacks.
View records in the database are uniquely defined as a combination of two keys.
The generation of this token needs to happen in the database and on demand. The database is accessed directly by another system that generates emails utilising the data in the view.
I have tried generating a sha1 hash based on the two keys and then url safe base64 encoding the result, but since it is a one way operation the lookup at the web end is unacceptably slow.
I think symmetric key encryption would be suitable, as long as the encryption occurred in the database, and the decryption occurred in the website, before the lookup.
At this stage I'm leaning towards building a CLR function to populate a generated column in the view.