mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 10:12:45 +00:00
Co-authored-by: Selis <12716288+ItsSelis@users.noreply.github.com> Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
20 lines
875 B
Plaintext
20 lines
875 B
Plaintext
/**
|
|
* returns a GUID like identifier (using a mostly made up record format)
|
|
* guids are not on their own suitable for access or security tokens, as most of their bits are predictable.
|
|
* (But may make a nice salt to one)
|
|
**/
|
|
/proc/GUID()
|
|
var/const/GUID_VERSION = "b"
|
|
var/const/GUID_VARIANT = "d"
|
|
var/node_id = copytext_char(md5("[rand()*rand(1,9999999)][world.name][world.hub][world.hub_password][world.internet_address][world.address][world.contents.len][world.status][world.port][rand()*rand(1,9999999)]"), 1, 13)
|
|
|
|
var/time_high = "[num2hex(text2num(time2text(world.realtime,"YYYY")), 2)][num2hex(world.realtime, 6)]"
|
|
|
|
var/time_mid = num2hex(world.timeofday, 4)
|
|
|
|
var/time_low = num2hex(world.time, 3)
|
|
|
|
var/time_clock = num2hex(TICK_DELTA_TO_MS(world.tick_usage), 3)
|
|
|
|
return "{[time_high]-[time_mid]-[GUID_VERSION][time_low]-[GUID_VARIANT][time_clock]-[node_id]}"
|