http://qs321.pair.com?node_id=218838


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!