how to encrypt a string using md5

Hi there,

I want to encrypt a string (using md5 algorithm) using shell script. Any ideas?
Is possible only using sh or awk ?

I can't install md5sum on my solaris machine

Thanks

regards,
catalin

Strictly speakly you can't encrypt anything with md5 because it's not an encryption algorithm. Ignoring that, you can use the digest command that appeared on Solaris 10.

On Linux:

$  echo hello | md5sum
b1946ac92492d2347c6235b4d2611184  -
$

And on Solaris 10:

$ echo hello | digest -a md5 /dev/fd/0
b1946ac92492d2347c6235b4d2611184
$