Jump to content


Photo

How This For A Script Snippet Koldfuzion?


  • Please log in to reply
25 replies to this topic

#1 flattspott

flattspott

    X-S Freak

  • Moderator
  • PipPipPipPipPip
  • 1,787 posts
  • Location:Southern California
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 19 June 2004 - 04:52 AM

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

Edited by flattspott, 19 June 2004 - 03:10 PM.


#2 geniusalz

geniusalz

    Team MXM

  • Head Moderators
  • PipPipPipPipPip
  • 1,827 posts
  • Gender:Male
  • Xbox Version:v1.1
  • 360 version:unknown

Posted 19 June 2004 - 04:57 AM

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

#3 pelago

pelago

    X-S Expert

  • Members
  • PipPipPip
  • 641 posts

Posted 19 June 2004 - 06: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.

#4 koldfuzion

koldfuzion

    X-S Freak

  • Members
  • PipPipPipPipPip
  • 1,480 posts

Posted 19 June 2004 - 10:35 AM

QUOTE
Anyway, KF, your inbox is full.


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



#5 Yuyu

Yuyu

    X-S Spirit Detective

  • Moderator
  • PipPipPipPipPip
  • 1,231 posts
  • Location:Belleville, IL
  • Interests:Football (Soccer) ... Umm, Xbox?
  • Xbox Version:v1.1
  • 360 version:v2 (zephyr)

Posted 19 June 2004 - 12:16 PM

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

#6 flattspott

flattspott

    X-S Freak

  • Moderator
  • PipPipPipPipPip
  • 1,787 posts
  • Location:Southern California
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 19 June 2004 - 02:12 PM

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.

#7 geniusalz

geniusalz

    Team MXM

  • Head Moderators
  • PipPipPipPipPip
  • 1,827 posts
  • Gender:Male
  • Xbox Version:v1.1
  • 360 version:unknown

Posted 19 June 2004 - 02:28 PM

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.

#8 flattspott

flattspott

    X-S Freak

  • Moderator
  • PipPipPipPipPip
  • 1,787 posts
  • Location:Southern California
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 19 June 2004 - 02:35 PM

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.

#9 flattspott

flattspott

    X-S Freak

  • Moderator
  • PipPipPipPipPip
  • 1,787 posts
  • Location:Southern California
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 19 June 2004 - 03:24 PM

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.



#10 geniusalz

geniusalz

    Team MXM

  • Head Moderators
  • PipPipPipPipPip
  • 1,827 posts
  • Gender:Male
  • Xbox Version:v1.1
  • 360 version:unknown

Posted 19 June 2004 - 04:05 PM

Someone called you retarded?

#11 koldfuzion

koldfuzion

    X-S Freak

  • Members
  • PipPipPipPipPip
  • 1,480 posts

Posted 19 June 2004 - 04:12 PM

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.






#12 geniusalz

geniusalz

    Team MXM

  • Head Moderators
  • PipPipPipPipPip
  • 1,827 posts
  • Gender:Male
  • Xbox Version:v1.1
  • 360 version:unknown

Posted 19 June 2004 - 04:18 PM

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

Edited by geniusalz, 19 June 2004 - 04:20 PM.


#13 BenJeremy

BenJeremy

    X-S Elysian

  • Head Moderators
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 9,690 posts
  • Gender:Male
  • Xbox Version:v1.1
  • 360 version:v1 (xenon)

Posted 19 June 2004 - 04:39 PM

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.

#14 flattspott

flattspott

    X-S Freak

  • Moderator
  • PipPipPipPipPip
  • 1,787 posts
  • Location:Southern California
  • Xbox Version:v1.0
  • 360 version:v1 (xenon)

Posted 19 June 2004 - 05:02 PM

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

Am I doing it right?

#15 BenJeremy

BenJeremy

    X-S Elysian

  • Head Moderators
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 9,690 posts
  • Gender:Male
  • Xbox Version:v1.1
  • 360 version:v1 (xenon)

Posted 19 June 2004 - 05:06 PM

Yes, but Geniusalz has said that the mod operator wasn't working, so I'll take a look at it shortly.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users