in reply to Safe for SQL
You could use the MD5->hexdigest() as well:
use strict; use Digest::MD5; sub generate_id { my $md5 = new Digest::MD5(); $md5->add($$ , time() , rand(9999) ); return $md5->hexdigest(); }
On my machine, this produces a 32 byte string which appears to be what you're looking for. BTW, this method is used in CGI::Session to create session ID's so it should be relatively safe to use in a SQL insert.
--
hiseldl
What time is it? It's Camel Time!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Safe for SQL
by Abigail-II (Bishop) on Dec 10, 2002 at 17:48 UTC | |
by hiseldl (Priest) on Dec 10, 2002 at 20:14 UTC |
In Section
Seekers of Perl Wisdom