# Md5 password generator

## trouby

Hey,

Is there any tool to create a hashed MD5 string ? Ldap config file can use {MD5} with MD5 string as its password and I have nothing to create that HASHED password with,

Thanks.

----------

## aridhol

A quick googling on your topic title gave me this:

http://www.trilug.org/~jeremy/md5.php

----------

## thodi

 *trouby wrote:*   

> Is there any tool to create a hashed MD5 string ? 
> 
> 

 

md5sum, should be in coreutils.

```

echo password | md5sum - 

```

----------

## trouby

fine, thanks.

----------

## trouby

md5sum works fine but it doesn't fit the {MD5}(hashed MD5 string) that slapd.conf expects, anyone?

----------

## thodi

```

echo password | md5sum - | perl -ne '/(\w+)/ && print "{MD5}$1"'

```

----------

## zhenlin

Use the correct tool for the job!

```
$ slappasswd -h '{MD5}'

New password:

Re-enter new password:

{MD5}bx7QAqtVlYWQFOvwlRUi2Q==

```

SHA1 hashing is stronger though, I think by 32 bits. (160 bits of hash space!)

----------

## trouby

That's exactly what I needed!

Well, MD5 is enough for me since the ldap is anyway not accessible for anyone but for several internal applications.

Thanks.

----------

## garfield

 *thodi wrote:*   

> 
> 
> ```
> 
> echo password | md5sum - | perl -ne '/(\w+)/ && print "{MD5}$1"'
> ...

 

This will NOT give the md5sum for password since echo sends a newline along with password to md5sum. You'll have to use the -n option with echo to get the correct password.  Without the Perl stuff the code will be

```

echo -n password | md5sum

```

----------

