SQL question
Herminio Hernandez, Jr.
herminio.hernandezjr at gmail.com
Mon Mar 6 10:07:38 MST 2017
I was following the tutorial the digital had. I am not a mysql expert so
you could be right.
On Mon, Mar 6, 2017 at 9:20 AM, Matt Graham <mhgraham at crow202.org> wrote:
> 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 at 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 at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.phxlinux.org/mailman/listinfo/plug-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.phxlinux.org/pipermail/plug-discuss/attachments/20170306/0603a7c5/attachment.html>
More information about the PLUG-discuss
mailing list