On 2017-03-05 21:27, Herminio Hernandez, Jr. wrote:
> UPDATE users SET
> password=ENCRYPT(%p,concat(_utf8'$1$',right(md5(rand()),8),_utf8'$'))
> WHERE username=%u LIMIT 1
>
> This is using md5 for the hashing where as I am using SHA
To expand on this, the MySQL encrypt() function calls the system's
crypt() function, which can be made to use a number of different hashes.
A salt starting with $1$ is md5, $6$ is SHA512.
> INSERT INTO `servermail`.`virtual_users`
> (`id`, `domain_id`, `password` , `email`)
> VALUES
> ('1', '1', ENCRYPT('firstpassword', CONCAT('$6$',
> SUBSTRING(SHA(RAND()), -16))), 'email1@example.com'),
> I want to format this query correctly.
I think this isn't quite right, because the salt has to end with a $
according to the man page for crypt. I think you want CONCAT('$6$',
SUBSTRING(SHA(RAND()), -16),'$')) but I could be wrong.
--
Crow202 Blog:
http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss