Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will PHP's sha1() and MySQL's SHA() give the same result?

Tags:

php

mysql

If no salt is used, will they be the same?

like image 655
Haroldo Avatar asked Feb 02 '23 22:02

Haroldo


1 Answers

Yes. The sha1 algorithm always produces the same value for the same input; that's the whole point of a hashing algorithm. They also both return a 40-character lowercase hex dump by default.

like image 145
Wooble Avatar answered Feb 05 '23 16:02

Wooble