just use md5_hex to get hex version of digest
That's a brilliant (obvious) idea. I wish I had thought of it before I wrote the code above (which now handles negative numbers as well). I assume your approach will work but I am not inclined to verify (the guy I am helping should be able to do it himself). Thanks!
Edit: After thinking about it for a minute, I don't think that would work. Basically, you have an 128 bit integer in binary form and you are then converting the first 64 bits of it into decimal form. I'm pretty sure a hex digest isn't going to help here because you can't simply just cut it in half.