PHP

Last week I was trying to figure out how to get a 28 character md5. An application I was trying to generate passwords required what looked to be a 28 char hash.

First off I tried

echo base64_encode(md5($password))


This returned way too many characters. After doing some research I found out it needs to be the binary out put of an md5. PHP 5+ has this option.
If the optional raw_output is set to TRUE, then the md5 digest is instead returned in raw binary format with a length of 16

To get the md5 binary format in php add TRUE to the md5() function.
echo base64_encode(md5($password, true))

This also works with sha1(base64)
echo base64_encode(sha1($password, true))
Links
http://www.insidepro.com/hashes.php?lang=eng
http://www.caucho.com/resin/admin/security-overview.xtp

Here are some ASP to PHP Conversions. It is by no means a full compare table but should have some helpful functions.

asp to php

Read more...