purum
purum

Reputation: 323

mysql md5(md5('pass') + salt) not equal php md5(md5('pass').salt)

MySql query:

select md5(md5('pass') + '123') from foo

gives c8ffe9a587b126f152ed3d89a146b445
while php md5(md5('pass').'123')
gives ae2553fb5786e36233d25c879faf3863


What is wrong?

Upvotes: 2

Views: 4133

Answers (2)

Chris Muench
Chris Muench

Reputation: 18338

select md5(CONCAT(md5('pass'), '123'))

+ is probably adding it.

Upvotes: 11

Eli
Eli

Reputation: 5620

That's not how you concatenate strings in MySQL. See for yourself: SELECT 'pass' + '123';

Instead try SELECT md5(concat(md5('pass'), '123')) from foo

Upvotes: 4

Related Questions