| 1 | <?php |
||
| 5 | class Uuid |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * return bool |
||
| 9 | */ |
||
| 10 | 104 | public static function active() |
|
| 14 | |||
| 15 | /** |
||
| 16 | * Return a UUID (version 4) using random bytes |
||
| 17 | * Note that version 4 follows the format: |
||
| 18 | * xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx |
||
| 19 | * where y is one of: [8, 9, A, B] |
||
| 20 | * |
||
| 21 | * We use (random_bytes(1) & 0x0F) | 0x40 to force |
||
| 22 | * the first character of hex value to always be 4 |
||
| 23 | * in the appropriate position. |
||
| 24 | * |
||
| 25 | * For 4: http://3v4l.org/q2JN9 |
||
| 26 | * For Y: http://3v4l.org/EsGSU |
||
| 27 | * For the whole shebang: http://3v4l.org/BkjBc |
||
| 28 | * |
||
| 29 | * @link https://paragonie.com/b/JvICXzh_jhLyt4y3 |
||
| 30 | * @link https://creativecommons.org/licenses/by-sa/4.0/ |
||
| 31 | * |
||
| 32 | * @return string |
||
| 33 | */ |
||
| 34 | 530 | public static function uuidv4() |
|
| 44 | } |
||
| 45 |