Last active
April 15, 2017 09:21
-
-
Save grimmdev/cc6672ad34a8391d544b9b60d6cb99df to your computer and use it in GitHub Desktop.
32 bits of goodness.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
public class ShortGUID | |
{ | |
private static Guid tmpGuid; | |
public static string NewGuid() | |
{ | |
tmpGuid = Guid.NewGuid (); | |
return Convert.ToBase64String(tmpGuid.ToByteArray()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function generate_uuid() { | |
return sprintf( '%04x%04x%04x%04x%04x%04x%04x%04x', | |
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), | |
mt_rand( 0, 0xffff ), | |
mt_rand( 0, 0x0fff ) | 0x4000, | |
mt_rand( 0, 0x3fff ) | 0x8000, | |
mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ) | |
); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment