Files
fulpstation/code/__HELPERS/guid.dm
John Willard da88f85361 [MDB IGNORE] [IDB IGNORE] Late September TGU (#367)
* tgu

* updated paths

* updating more paths

* master server

* more repaths

* tgu

* oh these were defined

* y

* tgu

* fixes fulp shuttles i think

* revert

* tgu

* fix checks and stuff

* Update sound.dm

* Update tg_edits.md

* tgu
2021-10-07 22:13:24 -06: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]}"