Guest Mixture63 Posted October 9, 2005 Share Posted October 9, 2005 ;UID Generator by Mixture63 MsgBox(0, "Random UID", GenerateUID()) func GenerateUID() $Section1 = Hex(Random(0, 256^2, 1), 4) & Hex(Random(0, 256^2, 1), 4) $Section2 = Hex(Random(0, 256^2, 1), 4) $Section3 = Hex(Random(0, 256^2, 1), 4) $Section4 = Hex(Random(0, 256^2, 1), 4) $Section5 = Hex(Random(0, 256^2, 1), 4) & Hex(Random(0, 256^2, 1), 4) & Hex(Random(0, 256^2, 1), 4) return "{" & $Section1 & "-" & $Section2 & "-" & $Section3 & "-" & $Section4 & "-" & $Section5 & "}" EndFunc I figured I'd seperate this from my other topic because it wasn't attracting any attention. I mean who would see it? Link to comment Share on other sites More sharing options...
Valik Posted October 9, 2005 Share Posted October 9, 2005 FYI: For anybody seriously considering using the function as posted, it does not generate true UUID's. The implementation just creates a string that looks like a UUID but it is not guaranteed to be unique across time and space which is the whole point of UUID's. Link to comment Share on other sites More sharing options...
Guest Mixture63 Posted October 9, 2005 Share Posted October 9, 2005 FYI: For anybody seriously considering using the function as posted, it does not generate true UUID's. The implementation just creates a string that looks like a UUID but it is not guaranteed to be unique across time and space which is the whole point of UUID's. Can you give me a link that'll show me the algorithm? I want to make a func myself. The link you showed me didn't say anything about the algorithim itself. Link to comment Share on other sites More sharing options...
Valik Posted October 9, 2005 Share Posted October 9, 2005 Here is the RFC (4122). Link to comment Share on other sites More sharing options...
Guest Mixture63 Posted October 9, 2005 Share Posted October 9, 2005 Here is the RFC (4122). OK, how much does it cost to higher a crypto-anylist? I can't seem to decipher the article. Link to comment Share on other sites More sharing options...
wiredbits Posted October 9, 2005 Share Posted October 9, 2005 ;UID Generator by Mixture63 MsgBox(0, "Random UID", GenerateUID()) func GenerateUID() $Section1 = Hex(Random(0, 256^2, 1), 4) & Hex(Random(0, 256^2, 1), 4) $Section2 = Hex(Random(0, 256^2, 1), 4) $Section3 = Hex(Random(0, 256^2, 1), 4) $Section4 = Hex(Random(0, 256^2, 1), 4) $Section5 = Hex(Random(0, 256^2, 1), 4) & Hex(Random(0, 256^2, 1), 4) & Hex(Random(0, 256^2, 1), 4) return "{" & $Section1 & "-" & $Section2 & "-" & $Section3 & "-" & $Section4 & "-" & $Section5 & "}" EndFuncI figured I'd seperate this from my other topic because it wasn't attracting any attention. I mean who would see it?You might also try this, You wll neend beta version of Autoit to run.#include <GuiConstants.au3>GuiCreate("test", 420, 331, 198,136 )GUISetFont(10)$EditGUID = GuiCtrlCreateInput("", 16, 72, 385, 25)$ButtonGUID = GuiCtrlCreateButton("GUID", 160, 136, 73, 25)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg=$ButtonGUID $str=GetGUID() GUICtrlSetData($EditGUID,$str) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelectWEndExitFunc GetGUID() Local $typelib,$str $typelib=ObjCreate("Scriptlet.TypeLib") $str=$TypeLib.Guid Return $strEndFuncYou might also try this, You wll neend beta version of Autoit to run.#include <GuiConstants.au3>GuiCreate("test", 420, 331, 198,136 )GUISetFont(10)$EditGUID = GuiCtrlCreateInput("", 16, 72, 385, 25)$ButtonGUID = GuiCtrlCreateButton("GUID", 160, 136, 73, 25)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg=$ButtonGUID $str=GetGUID() GUICtrlSetData($EditGUID,$str) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelectWEndExitFunc GetGUID() Local $typelib,$str $typelib=ObjCreate("Scriptlet.TypeLib") $str=$TypeLib.Guid Return $strEndFuncseems i need to learn how to post code, another things to do added...LOL Link to comment Share on other sites More sharing options...
Guest Mixture63 Posted October 9, 2005 Share Posted October 9, 2005 You might also try this, You wll neend beta version of Autoit to run.#include <GuiConstants.au3>GuiCreate("test", 420, 331, 198,136 )GUISetFont(10)$EditGUID = GuiCtrlCreateInput("", 16, 72, 385, 25)$ButtonGUID = GuiCtrlCreateButton("GUID", 160, 136, 73, 25)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg=$ButtonGUID $str=GetGUID() GUICtrlSetData($EditGUID,$str) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelectWEndExitFunc GetGUID() Local $typelib,$str $typelib=ObjCreate("Scriptlet.TypeLib") $str=$TypeLib.Guid Return $strEndFuncseems i need to learn how to post code, another things to do added...LOLYea, well thats a generator APP, I just wanted to make a func.But I like it.I don't understand what Scriptlet.TypeLib.Guid has to do with generating a Guid. I just thought that wasthe Guid of that COM object. Link to comment Share on other sites More sharing options...
Valik Posted October 9, 2005 Share Posted October 9, 2005 (edited) OK, how much does it cost to higher a crypto-anylist? I can't seem to decipher the article. That RFC is easy to read. There are lots of others that are far more complicated.The approach presented by wiredbits is valid. The COM object being used is mentioned here. It basically wraps the Windows API calls necessary to generate the string form of a UUID and returns them for use by a scripting language. Edited October 9, 2005 by Valik Link to comment Share on other sites More sharing options...
layer Posted October 9, 2005 Share Posted October 9, 2005 Valik, Something is wrong with that link. I tired removing the ''" 's and the double "http://" but it still didn't work. FootbaG Link to comment Share on other sites More sharing options...
LxP Posted October 9, 2005 Share Posted October 9, 2005 Hmm, it worked fine for me -- no weirdness with the link.http://www.ietf.org/rfc/rfc4122.txt Link to comment Share on other sites More sharing options...
layer Posted October 9, 2005 Share Posted October 9, 2005 That RFC is easy to read. There are lots of others that are far more complicated.The approach presented by wiredbits is valid. The COM object being used is mentioned here. It basically wraps the Windows API calls necessary to generate the string form of a UUID and returns them for use by a scripting language.@LxP,I meant the link in Valik's post i just quoted FootbaG Link to comment Share on other sites More sharing options...
/dev/null Posted October 9, 2005 Share Posted October 9, 2005 Valik,Something is wrong with that link. I tired removing the ''" 's and the double "http://" but it still didn't work.this works for me: http://www.asp-dev.com/main.asp?page=60CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
layer Posted October 9, 2005 Share Posted October 9, 2005 this works for me: http://www.asp-dev.com/main.asp?page=60CheersKurtI swear I tired that and it didn't work. But it does now... Thanks :"> FootbaG Link to comment Share on other sites More sharing options...
/dev/null Posted October 9, 2005 Share Posted October 9, 2005 Can you give me a link that'll show me the algorithm? I want to make a func myself. The link you showed me didn't say anything about the algorithim itself.Try the UDF listed here: http://www.autoitscript.com/forum/index.php?showtopic=11865CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
wiredbits Posted October 9, 2005 Share Posted October 9, 2005 Try the UDF listed here: http://www.autoitscript.com/forum/index.php?showtopic=11865CheersKurt Was wondering if Auoit releases any resources used when creating a object..IE $typelib=ObjCreate("Scriptlet.TypeLib"). In VB i see they use Set TypeLib = Nothing, hmm support in scraps If not I will use the Dllcall func you linked to instead of Scriptlet.TypeLib call. ThanksJim Link to comment Share on other sites More sharing options...
Valik Posted October 9, 2005 Share Posted October 9, 2005 Valik,Something is wrong with that link. I tired removing the ''" 's and the double "http://" but it still didn't work.Thanks layer. I fixed the link. It was something the forum did because I used ' instead of " to surround the URL. Very strange. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 10, 2005 Share Posted October 10, 2005 (edited) the following is also posted here http://www.autoitscript.com/forum/index.ph...ndpost&p=115072 expandcollapse popupConst $ERROR_SUCCESS = 0 Const $RPC_S_OK = $ERROR_SUCCESS Const $RPC_S_UUID_LOCAL_ONLY = 1824 Const $RPC_S_UUID_NO_ADDRESS = 1739 ;~ typedef struct _GUID { ;~ unsigned long Data1; ;~ unsigned short Data2; ;~ unsigned short Data3; ;~ unsigned char Data4[8]; ;~ } GUID, UUID; ;~ Data1 ;~ Specifies the first 8 hexadecimal digits of the UUID. ;~ Data2 ;~ Specifies the first group of 4 hexadecimal digits of the UUID. ;~ Data3 ;~ Specifies the second group of 4 hexadecimal digits of the UUID. ;~ Data4 ;~ Array of eight elements. The first two elements contain the third group of 4 hexadecimal digits of the UUID. ;~ The remaining six elements contain the final 12 hexadecimal digits of the UUID. $_GUID = DllStructCreate("uint;ushort;ushort;ubyte[8]") If @error Then Exit ;~ RPC_STATUS RPC_ENTRY UuidCreate( ;~ UUID __RPC_FAR* Uuid ;~ ); $ret = DllCall("Rpcrt4.dll","ptr","UuidCreate","ptr",DllStructGetPtr($_GUID)) If Not @error Then If $ret[0] = $ERROR_SUCCESS Then $uuid = Hex(DllStructGetData($_GUID,1),8) & "-" & _ Hex(DllStructGetData($_GUID,2),4) & "-" & _ Hex(DllStructGetData($_GUID,3),4) & "-" & _ Hex(DllStructGetData($_GUID,4,1),2) & Hex(DllStructGetData($_GUID,4,2),2) & "-" For $x =3 to 8 $uuid = $uuid & Hex(DllStructGetData($_GUID,4,$x),2) Next ConsoleWrite($uuid & @LF) EndIf EndIf DllStructDelete($_GUID) Edited October 10, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now