HowTo generate a valid Joomla! MySQL password hash in linux bash





	1) your cleartext password - e.g. "all4security"
	$ pass="all4security"

	2) generate a random salt
	$ salt=`< /dev/urandom tr -dc "A-Za-z0-9" | head -c32`

	3) md5 hash of your password followd by your salt
	$ hash=$(echo -n $pass$salt | openssl md5)
	
	4) your final password hash is the md5 hash generated before followed by the salt, seperated by a ":"
	$ pass="$hash:$salt"
	$ echo "$pass"




	Here is the simple bash script:

	#!/bin/bash
	# generates the salted password for joomla 1.5 / 2.5
	# by markus sesser / 2011-04-13

	# checks
	if [ $# = 0 ]; then
	        echo "Usage: $0 "
	        exit 0
	fi
	pass=$1
	salt=`< /dev/urandom tr -dc "A-Za-z0-9" | head -c32`
	hash=$(echo -n $pass$salt | openssl md5)
	pass="$hash:$salt"
	echo "$pass"

 


by Markus Sesser