Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since you want to be able to recreate the identifier on two, disconnected, databases then you'll need to have some kind of shared key.</p> <p>This is a perfect place for a <a href="http://en.wikipedia.org/wiki/Hmac" rel="nofollow noreferrer">HMAC</a>. To steal from <a href="http://www.ietf.org/rfc/rfc2104.txt" rel="nofollow noreferrer">RFC-2104</a> by way of Wikipedia:</p> <blockquote> <p>Let:<br /> H(·) be a cryptographic hash function<br /> K be a secret key padded to the right with extra zeros to the block size of the hash function<br /> m be the message to be authenticated<br /> ∥ denote concatenation<br /> ⊕ denote exclusive or (XOR)<br /> opad be the outer padding (0x5c5c5c…5c5c, one-block-long hexadecimal constant)<br /> ipad be the inner padding (0x363636…3636, one-block-long hexadecimal constant)<br /></p> <p>Then HMAC(K,m) is mathematically defined by<br /> HMAC(K,m) = H((K ⊕ opad) ∥ H((K ⊕ ipad) ∥ m)).</p> </blockquote> <p>But, you don't have to implement it yourself! Use your language of choice's standard library. For example, in Python:</p> <pre><code>&gt;&gt;&gt; import hmac &gt;&gt;&gt; hmac.new(key='abc123secret make me long', msg='This is my unique key #1') &lt;hmac.HMAC instance at 0xb77bdbac&gt; &gt;&gt;&gt; _.hexdigest() 'c23a224afa917d13fbef58ee14884269' </code></pre> <p>Now you have a calculable unique ID. Pre-compute as the primary-keys in your database. Lookup as necessary!</p> <hr> <p>As a sidenote, do <strong>NOT</strong> use salted hash (Google: <a href="http://benlog.com/articles/2008/06/19/dont-hash-secrets/" rel="nofollow noreferrer">"don't hash secrets"</a>) and do <strong>NOT</strong> use an encrypted version of your data. The former because of message-extension attacks. The latter because you're unnecessarily exposing the data in a manner that replies solely on your key security.</p> <p>I'd link with more references, but I'm a new user. :-\</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload