Skip to content

Instantly share code, notes, and snippets.

@marydn
Created April 26, 2014 16:19
Show Gist options
  • Save marydn/11324213 to your computer and use it in GitHub Desktop.
Save marydn/11324213 to your computer and use it in GitHub Desktop.

Revisions

  1. marydn created this gist Apr 26, 2014.
    6 changes: 6 additions & 0 deletions token.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    <?php
    // 32-byte length
    $token = md5(uniqid(mt_rand(), true));

    // 256
    $token = bin2hex(mcrypt_create_iv(128, MCRYPT_DEV_RANDOM));