Q:

duplicating mysql primary key as MD5 equivalent

For each record in my tables, there is a ID, then Public_ID.
The ID is an auto-incremented int. The Public_ID is an MD5 hash of the INT in ID.
To generate this Public_ID, I typically get the insert id which matches is the value of ID, then I generate the Public_ID and update the record where ID matches the Insert ID.
Is there a more efficient way of generating the Public_ID without having to count, or update after inserting?
Thanks,
Peter

A:

If you are going to use MD5 to hash the ID, you might as well generate a GUID.

