Files
Bubberstation/code/__HELPERS/guid.dm
SkyratBot cc93b11d23 [MIRROR] _HELPERS/unsorted.dm has been sorted [MDB IGNORE] (#8627)
* _HELPERS/unsorted.dm has been sorted

* Feexing conflicts

Co-authored-by: Ghilker <42839747+Ghilker@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
2021-10-06 22:07:01 +01:00

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]}"