| CODE |
// GUID Generator
Set GUID "" For I = 1 To 5 Set GUID%I% "" Next
Set Part1 8 Set Part2 4 Set Part3 4 Set Part4 4 Set Part5 12 Set Split -
Set g1 $SerialNumber$ Set g2 $XboxVersion$ Set g3 $MAC$ Set g4 $Time$ Set g5 $Timer$
Set Table "0123456789abcdef" SetFunc Count Length %Table%
For I = 0 To %Count% SetFunc Char%I% Mid %I% 1 %Table% Next
For S = 1 To 5 For I = 1 To %Part{S}% :Again Set Current $rand$ Mod Current %Count% If# %Current% < 0 Goto Again Set GUID%S% %GUID{S}%%Char{Current}% Set GUID%S% %GUID{S}%%g{S}% SetFunc GUID%S% MD5 %GUID{S}% SetFunc GUID%S% Left %Part{S}% %GUID{S}% Next If# %S% == 5 Then Set Split "" EndIf Set GUID %GUID%%GUID{S}%%Split% Next
Set GUID {%GUID%} MsgBox "GUID is %GUID%" Quit |
EDIT. I changed it a little...
This post has been edited by flattspott: Jun 19 2004, 04:21 PM <
But you're defeating the purpose of a GUID being a GUID. I think there's more to it than just random numbers.
Anyway, KF, your inbox is full.
The script reminds me of a bug: the mod command sometimes returns negatives when using $rand$. <
Yeah, to generate GUIDs 'properly', you're supposed to use the machines MAC address, current time, and various other things I can't remember. The idea is that no two machines can create the same GUID twice. http://hegel.ittc.uk...ds-guids-01.txt I think is the definitive reference, but it may have been superceded.
| QUOTE |
| Anyway, KF, your inbox is full. |
yea, i saw that, its been cleaned up but i think i still got the msg.
<
| QUOTE (pelago @ Jun 19 2004, 03:59 AM) |
| Yeah, to generate GUIDs 'properly', you're supposed to use the machines MAC address, current time, and various other things I can't remember. The idea is that no two machines can create the same GUID twice. http://hegel.ittc.uk...ds-guids-01.txt I think is the definitive reference, but it may have been superceded. |
Yeah, we have a real GUID creator on the mediaxmenu website, in the scripting section, already... I believe flattspott was just messing around with a concept...
Well what I I were to do this
65BD716E%XBOXMAC% > MD5 > First 8 letters
DC1A%XBOXMAC% > MD5 > First 4 letters
4d07%XBOXMAC% > MD5 > First 4 letters
9FCD%XBOXMAC% > MD5 > First 4 letters
0C2FFE3B78FE%XBOXMAC% > MD5 > First 12 letters
Hopefully you get the idea. Wouldn't that be unique?
The point was so I could could convert xas files to Modules and install then in the File Manager. <
The actual GUID is designed to be globally unique until the next century or so. Meaning, any ID's being generated on any machine in the world will be different.
However, on the xbox, we will probably not need that 'secure' uniqueness, because the chances of a matching ID are pretty slim. So you could work with completely random digits.
From what I know, a part of the ID is generated using the current time on the machine, and then another part of it is generated from the MAC. Therefore, every machine will generate different ID's at different times, and every machine will generate different ID's even at the same time because of the MAC. <
| QUOTE |
| The script reminds me of a bug: the mod command sometimes returns negatives when using $rand$. |
Thats what I said back in the day. Everyone thought I was retarded or something.
That's why I put If# %Current% < 0 Goto Again in it.
Anywho, I thought the script what pretty good seeing how simple it is. <
I just put the whole thing into a For Loop and spit out each GUID to a file 1000 times. Then using UltraEdit I sorted the list to check for dupes. Everyone was unique.
<
Someone called you retarded? <
btw.. i concur.
you were setting
| QUOTE |
Set g1 $SerialNumber$ Set g2 $XboxVersion$ Set g3 $MAC$ Set g4 $Time$ Set g5 $Timer$
|
but nowhere in the script did i see you use them in the guid creation.
you could probably just use something like
MD5($SerialNumber$$RANDOMNUMBER$XboxVersion$$MAC$$Time$)
and format it accordinly to get a decent GUID for the xbox.
<
| QUOTE |
| Set GUID%S% %GUID{S}%%g{S}% |
I don't know when it was added, but it's there.
Edit: Maybe you shouldn't use serial numbers in there
Oh, BTW....random numbers are generated as DWORDs (unsigned 32 bit), but when examining values as numbers, it looks at them as signed. I'll have to take a quick look at the random "special" to make sure it's formatting it as unsigned. <
That reminds me %($rand%100)% and dont work right.
Am I doing it right? <
Yes, but Geniusalz has said that the mod operator wasn't working, so I'll take a look at it shortly. <
Well, easily fixed. The original code (not that I'm pointing fingers at you, Geniusalz), but the parser was lacking the '%' in the case statement. Easily solved.
I also will make sure all (int) casts are changed to (__int64) casts.
Doing some more checks...
Another stupid bug which doesn't really affect anything is that the 'length' parameter for the evaluate function is treated as 'end+1'. It doesn't matter, because all strings passed are trimmed before passing.
Just wondering: does mxm do anything with 'cout's? They should be changed to 'real' error messages.
| QUOTE (geniusalz @ Jun 19 2004, 02:50 PM) |
Another stupid bug which doesn't really affect anything is that the 'length' parameter for the evaluate function is treated as 'end+1'. It doesn't matter, because all strings passed are trimmed before passing.
Just wondering: does mxm do anything with 'cout's? They should be changed to 'real' error messages. |
OK, I've converted them to LOGMSG calls.
I was getting an odd "FATX: found unrecognized signature" message repeated times in the last run. I have no clue as to what causes the message (something buried inthe Kernel, to be sure).
That might be the cause of some "Unable to read file" errors I've been getting in the gamesave manager, even though I open/close all files properly.
Strange.
Well, I'm alternating between MXM and watching Band Of Brothers with my older son.... hopefully, there will be a WIP update tonight.
| QUOTE (BenJeremy @ Jun 19 2004, 10:05 PM) |
| watching Band Of Brothers with my older son.... hopefully, there will be a WIP update tonight. |
Sorry but I've got to jump in here, that program rocked so much, there were 10 episodes I believe, are you enjoying it? THis reminded me I haven't cracked open my box set I got a couple of weeks back.. I really enjoyed this show, nearly as much as 24
| QUOTE (chilin_dude @ Jun 19 2004, 05:09 PM) |
Sorry but I've got to jump in here, that program rocked so much, there were 10 episodes I believe, are you enjoying it? THis reminded me I haven't cracked open my box set I got a couple of weeks back.. I really enjoyed this show, nearly as much as 24 |