simplest way is:

SID := random(high(Integer));

which allows for 2 billion (4 if you use a cardinal).
Maybe try int64 if you really need that many.

Depends on your purposes, but for short term ID's I find 2 billion more than
enough.

regards,
Steve

-----Original Message-----
From: Myles Penlington [mailto:[EMAIL PROTECTED]]
Sent: Monday, 12 November 2001 5:48 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: GUIDs for Session Ids?


Need to be careful with guids, as in somecases they are sequential in nature
- depends on implementation, service pack etc. I know they have changed in
more recent times to be less sequential in nature - was viewed as a security
hole for some reason by MS.

Depends on your security requirements. We use a 128bit hashed value, based
on various things.

Myles.


-----Original Message-----
From: Vaughan, Benjamin Carl [mailto:[EMAIL PROTECTED]]
Sent: Monday, 12 November 2001 3:41 p.m.
To: Multiple recipients of list delphi
Subject: RE: [DUG]: GUIDs for Session Ids?


Hi,

>My first question is, is this a good idea (using a GUID as a session Id)
We use GUID's as session Id's for our website, and currently have had no
problems using these as Session IDs. (the website goes through approx 4400
sessions per day)

>My second question is, if it is an alright idea, what is the easiest way
>to get hold of a GUID (at run time), do I need to link in all the COM
>stuff and use and use the CreateClassID function (I don't think any COM
>stuff is linked in at the moment and as it is a web app I thought I
>would try and keep it small, and maybe even venture into Kylix in the
>future???).

As for GUID creation we use the WinAPI function CoCreateGUID to create the
GUID's at runtime. We then store these on our SQLServer database for
retrieval at a later time.

Hope that helps.

Ben Vaughan
Developer
www.cecil.edu

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to