I'm using the MD5 hash function of MySQL to hash some data I import into the database from a CSV file.
The issue is that some lines have an incorrect hash (but not all of them).
When I use a query:
UPDATE mytable SET email_md5 = (SELECT MD5(email))
MySQL inserts some wrong hashes in the table but when I check with using
I find the correct answer.
Any idea how to check the encoding of the data I import in the database?
For this email email@example.com (not existing anymore)
Mysql insert this hash when I using MySQL query (the first in this post) with data in database from the CSV
But when I insert the same email with my hands in database and replay the same query I find this hash (and is the correct hash)
We using mysql 8 and adminer
I feel it is a problem of encoding.
When I select the line for edit it from adminer and save it without any changes the browser recognize it like an email (she becomes clickable link with mailto:) + after this when I replay the query he add the good hash ! !
The row don't recognize like an email in adminer give me wrong hash
the lines from adminer recognize like an email have the good hash...
This is f*** creazy !
For datatype, it's varchar(200) NULL
With another email where I find a MD5 issue
From MySQL with
SELECT MD5(email) FROM mytable WHERE id = 'theID';
SELECT HEX(email) FROM mytable WHERE id = 'theID';