Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reverse a GUID? Fastest way?
Message
From
22/03/2008 00:02:40
 
 
To
21/03/2008 22:51:38
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01304506
Message ID:
01304517
Views:
20
>>>>>Thanks
>>>>
>>>>May I ask why you want to do that?
>>>
>>>I can't tell you yet.
>>
>>err ... OK. ("yet" is the key word here)
>>
>Here's a sample of how I applied what you provided:
>
>
m.cGUID = REPLICATE(CHR(0),16)
>CoCreateGuid(@m.cGUID)
>m.cGuid = ;
>	BinToC(CToBin(Right(m.cGuid, 8), "BRS"), "BRS") + ;
>	BinToC(CToBin(Left(m.cGuid, 8), "BRS"), "BRS")
>
>It's a little faster. Looks like the timing I'm seeing is not just from the reversal process.
>
>Thanks

OK, a couple of things: CoCreateGuid takes its time too, try with this one instead, it is supposed to be a tad faster, since CoCreateGuid just calls this other API function.
Declare Integer UuidCreate In rpcrt4.Dll As apiUuidCreate ;
	String @Uuid

apiUuidCreate(@m.Uuid)
http://msdn2.microsoft.com/en-us/library/ms688568(VS.85).aspx

"The CoCreateGuid function calls the RPC function UuidCreate, ..."

If you don't mind giving away the MAC address in the GUID, try this one, MSDN says its a little faster:
Declare Integer UuidCreateSequential In rpcrt4.Dll As apiUuidCreateSequential ;
	String @Uuid

apiUuidCreateSequential(@m.Uuid)
http://msdn2.microsoft.com/en-us/library/aa379322(VS.85).aspx

"For security reasons, UuidCreate was modified so that it no longer uses a machine's MAC address to generate UUIDs. UuidCreateSequential was introduced to allow creation of UUIDs using the MAC address of a machine's Ethernet card."

"Note The UuidCreateSequential function tends to be slightly faster than the UuidCreate function. When the performance of the generation of a UUID is a significant consideration, the UuidCreateSequential function may be used."

So there you have two other options to try, and still waiting to find out what you are into...

Carlos
Previous
Reply
Map
View

Click here to load this message in the networking platform