title: How to create a time limited hash/key?
body: <p>I am trying to create a time limited key to use in one of my applications. The key is used to unlock certain bits of functionality in an application.</p>
  
  <p>My thinking so far is</p>
  
  <p>to generate:
  cryptographic hash the various bits of info I need + key generation date</p>
  
  <p>to validate:
  cryptographic hash the various bits of info I need + date now</p>
  
  <p>if all the info is the same and the date is the same I get the same value</p>
  
  <p>But,</p>
  
  <p>this means the key will only work on a certain date. What I want is a key that is valid for the next 24 hours (or extending this, few days/week/month).</p>
  
  <p>I can extend the period but there is always the possibility of generating the key just before the period expires, like the last day of the month for a month key.</p>
  
  <p>Firstly, is this an acceptable way of proceeding at all? If so, how do I do it?</p>
  
  <p><em>I am aware that "winding" the clock back will defeat the system - but I am still interested in getting some opinions</em></p>
  
  <p><em>I have read <a href="https://stackoverflow.com/questions/5526803/how-do-i-generate-a-time-limited-key-or-password-without-storing-data">How do I generate a time limited key or password without storing data</a> which is a similar issue.</em></p>