Raised This Month: $7 Target: $400
 1% 

Convert STEAMID to Steam Community ID


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
voogru
Inspector Javert
Join Date: Oct 2004
Old 09-16-2007 , 00:09   Convert STEAMID to Steam Community ID
Reply With Quote #1

I figured I would share this little snippet, this will convert a STEAMID to the a players friendID which is used for steam community.

What could potentially be done with this, is to fetch data on a player, see what groups he is in, and basically gives you the flexibility to ban whole groups from your server without knowing all of their steamids.

At least, thats what I intend to do with it. You can also of course do the reverse, converting friend ID's to steamids.

PHP Code:
__int64 GetFriendID( const char *pszAuthID )
{
    if(!
pszAuthID)
        return 
0;

    
int iServer 0;
    
int iAuthID 0;

    
char szAuthID[64];
    
strcpy_s(szAuthID63pszAuthID);

    
char *szTmp strtok(szAuthID":");
    while(
szTmp strtok(NULL":"))
    {
        
char *szTmp2 strtok(NULL":");
        if(
szTmp2)
        {
            
iServer atoi(szTmp);
            
iAuthID atoi(szTmp2);
        }
    }

    if(
iAuthID == 0)
        return 
0;

    
__int64 i64friendID = (__int64)iAuthID 2;

    
//Friend ID's with even numbers are the 0 auth server.
    //Friend ID's with odd numbers are the 1 auth server.
    
i64friendID += 76561197960265728 iServer

    return 
i64friendID;

Have fun.

Edit: Using this a Pure MySQL was created

Last edited by devicenull; 02-22-2009 at 21:43.
voogru is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 09-16-2007 , 00:22   Re: Convert STEAMID to Steam Community ID
Reply With Quote #2

Really interesting data...

I would never have thought there was a relation ship

+Karma for you
__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
BAILOPAN
Join Date: Jan 2004
Old 09-16-2007 , 10:36   Re: Convert STEAMID to Steam Community ID
Reply With Quote #3

That's pretty awesome, voogru. I'm curious as to how you discovered this -- observation with some trial and error?

out of boredom I went and looked up the first few steamids to see how many were definitely valve employees:
Code:
steam_0:0:1 (alfred)
steam_0:1:1 (ErikJ)
steam_0:1:2 (alfred)
steam_0:0:5 (greg coomer)
steam_0:0:6 (john cook)
steam_0:1:7 (taylor sherman)
steam_0:0:8 (chris bokitch)
steam_0:1:9 (lyncho?)
steam_0:1:10 (eric smith)
__________________
egg

Last edited by BAILOPAN; 09-16-2007 at 10:54.
BAILOPAN is offline
voogru
Inspector Javert
Join Date: Oct 2004
Old 09-16-2007 , 13:10   Re: Convert STEAMID to Steam Community ID
Reply With Quote #4

Quote:
Originally Posted by BAILOPAN View Post
That's pretty awesome, voogru. I'm curious as to how you discovered this -- observation with some trial and error?

out of boredom I went and looked up the first few steamids to see how many were definitely valve employees:
Code:
steam_0:0:1 (alfred)
steam_0:1:1 (ErikJ)
steam_0:1:2 (alfred)
steam_0:0:5 (greg coomer)
steam_0:0:6 (john cook)
steam_0:1:7 (taylor sherman)
steam_0:0:8 (chris bokitch)
steam_0:1:9 (lyncho?)
steam_0:1:10 (eric smith)
A bit of trial and error.

I got the friendID for these two ID's:

STEAM_0:1:1182 (76561197960268093)
STEAM_0:10679 (76561197960327087)

I noticed that the 2 friend ID's were identicle up until 11th number.
76561197960 268093
76561197960 327087

Then I tried this:

76561197960327087 - 76561197960268093 = 58994

Result was higher than expected, so I cut it in half for giggles.

58994 / 2 = 29497

Hmm.. not too far from 30679..

29497 + 1182 = 30679 DING DING DING DING

and

30679 - 29497 = 1182 DING DING DING DING



To get the first number, I then did:

76561197960268093 - (1182 * 2) = 76561197960265729

But, I use the 76561197960265728 number and then just increment it by what the auth server is.

There does not appear to be a STEAM_0:0:0 ID, but there is a STEAM_0:1:0 ID.

Now with this knowledge, I also have the option of storing steamid's as 64 bit ints rather than strings.

My question to valve is where the hell did they pull out a number like 76561197960265728.

A friend of mine pointed out when it's converted to hex it's 110000100000000, but no idea if that is significant or not.

Last edited by voogru; 09-16-2007 at 13:27.
voogru is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 09-16-2007 , 23:16   Re: Convert STEAMID to Steam Community ID
Reply With Quote #5

holy cow
__________________
M249-M4A1 is offline
Extreme_One
Veteran Member
Join Date: Nov 2006
Old 09-17-2007 , 18:34   Re: Convert STEAMID to Steam Community ID
Reply With Quote #6

Wow

That's really clever!
__________________
Extreme_One is offline
BAILOPAN
Join Date: Jan 2004
Old 09-17-2007 , 19:00   Re: Convert STEAMID to Steam Community ID
Reply With Quote #7

voogru: thanks for the logic path behind that

Of course you could just store them as 32-bit integers if you wanted... if you just do the X*2 + 1, it will be a long time before they overflow. Nice idea either way for lookup algorithms.
__________________
egg

Last edited by API; 11-24-2007 at 16:41. Reason: but to bit lol
BAILOPAN is offline
voogru
Inspector Javert
Join Date: Oct 2004
Old 09-17-2007 , 23:13   Re: Convert STEAMID to Steam Community ID
Reply With Quote #8

Quote:
Originally Posted by BAILOPAN View Post
voogru: thanks for the logic path behind that

Of course you could just store them as 32-but integers if you wanted... if you just do the X*2 + 1, it will be a long time before they overflow. Nice idea either way for lookup algorithms.
Yeah, I realized that, but what if someday valve takes over the world and has more than 4 billion steam accounts?
voogru is offline
M249-M4A1
I <3 Mac
Join Date: May 2005
Location: Not interested
Old 09-18-2007 , 22:06   Re: Convert STEAMID to Steam Community ID
Reply With Quote #9

Quote:
Originally Posted by voogru View Post
Yeah, I realized that, but what if someday valve takes over the world and has more than 4 billion steam accounts?
stop hacking the pentagon
__________________
M249-M4A1 is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 11-17-2007 , 16:04   Re: Convert STEAMID to Steam Community ID
Reply With Quote #10

You should post this in the AMXX section too.
Lee is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:12.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode