xboxscene.org forums

Pages: [1] 2

Author Topic: How This For A Script Snippet Koldfuzion?  (Read 865 times)

flattspott

  • Archived User
  • Hero Member
  • *
  • Posts: 1220
How This For A Script Snippet Koldfuzion?
« on: June 18, 2004, 11:03:00 PM »

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 <
Logged

geniusalz

  • Archived User
  • Hero Member
  • *
  • Posts: 1635
How This For A Script Snippet Koldfuzion?
« Reply #1 on: June 18, 2004, 11:08:00 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$.  <
Logged

pelago

  • Recovered User
  • Full Member
  • *
  • Posts: 209
How This For A Script Snippet Koldfuzion?
« Reply #2 on: June 18, 2004, 11:59:00 PM »

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.
Logged

koldfuzion

  • Archived User
  • Hero Member
  • *
  • Posts: 1226
How This For A Script Snippet Koldfuzion?
« Reply #3 on: June 19, 2004, 04:46:00 AM »

QUOTE
Anyway, KF, your inbox is full.


yea, i saw that, its been cleaned up but i think i still got the msg.

 <
Logged

Yuyu

  • Archived User
  • Hero Member
  • *
  • Posts: 908
How This For A Script Snippet Koldfuzion?
« Reply #4 on: June 19, 2004, 05:16:00 AM »

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...
Logged

flattspott

  • Archived User
  • Hero Member
  • *
  • Posts: 1220
How This For A Script Snippet Koldfuzion?
« Reply #5 on: June 19, 2004, 08:23:00 AM »

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.  <
Logged

geniusalz

  • Archived User
  • Hero Member
  • *
  • Posts: 1635
How This For A Script Snippet Koldfuzion?
« Reply #6 on: June 19, 2004, 08:39:00 AM »

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.  <
Logged

flattspott

  • Archived User
  • Hero Member
  • *
  • Posts: 1220
How This For A Script Snippet Koldfuzion?
« Reply #7 on: June 19, 2004, 08:46:00 AM »

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.   <
Logged

flattspott

  • Archived User
  • Hero Member
  • *
  • Posts: 1220
How This For A Script Snippet Koldfuzion?
« Reply #8 on: June 19, 2004, 09:35:00 AM »

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.

 <
Logged

geniusalz

  • Archived User
  • Hero Member
  • *
  • Posts: 1635
How This For A Script Snippet Koldfuzion?
« Reply #9 on: June 19, 2004, 10:16:00 AM »

Someone called you retarded?  <
Logged

koldfuzion

  • Archived User
  • Hero Member
  • *
  • Posts: 1226
How This For A Script Snippet Koldfuzion?
« Reply #10 on: June 19, 2004, 10:23:00 AM »

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.




 <
Logged

geniusalz

  • Archived User
  • Hero Member
  • *
  • Posts: 1635
How This For A Script Snippet Koldfuzion?
« Reply #11 on: June 19, 2004, 09:18:00 AM »

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 ph34r.gif
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
How This For A Script Snippet Koldfuzion?
« Reply #12 on: June 19, 2004, 10:50:00 AM »

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.  <
Logged

flattspott

  • Archived User
  • Hero Member
  • *
  • Posts: 1220
How This For A Script Snippet Koldfuzion?
« Reply #13 on: June 19, 2004, 11:13:00 AM »

That reminds me %($rand%100)% and  dont work right.

Am I doing it right?  <
Logged

BenJeremy

  • Archived User
  • Hero Member
  • *
  • Posts: 5645
How This For A Script Snippet Koldfuzion?
« Reply #14 on: June 19, 2004, 11:17:00 AM »

Yes, but Geniusalz has said that the mod operator wasn't working, so I'll take a look at it shortly.  <
Logged
Pages: [1] 2