Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generate Steam DeviceID by SteamID for accepting mobile confirmations
<?php
/**
* Generate device id by steamid
* Usage: getDeviceID('steamid');
*
* @param string $steamid SHOULD BE STRING
* @return string
*/
function getDeviceID($steamid) {
$sha1 = sha1($steamid);
$cut = substr($sha1, 0, 32);
$deviceID = preg_replace('/^([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12}).*$/', '$1-$2-$3-$4-$5', $cut);
$prepend = 'android:';
return $prepend . $deviceID;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.