
{"id":76,"date":"2008-11-11T16:08:24","date_gmt":"2008-11-11T14:08:24","guid":{"rendered":"http:\/\/dasini.net\/blog\/?p=76"},"modified":"2008-11-11T18:16:15","modified_gmt":"2008-11-11T16:16:15","slug":"hash-securite-mysql","status":"publish","type":"post","link":"https:\/\/dasini.net\/blog\/2008\/11\/11\/hash-securite-mysql\/","title":{"rendered":"Hash, s\u00e9curit\u00e9 &#038; MySQL"},"content":{"rendered":"<p><!-- \t\t@page { margin: 2cm } \t\tP { margin-bottom: 0.21cm } \t\tH2 { margin-bottom: 0.21cm } \t\tH2.western { font-family: \"Arial\", sans-serif; font-size: 14pt; font-style: italic } \t\tH2.cjk { font-size: 14pt; font-style: italic } \t\tH2.ctl { font-size: 14pt; font-style: italic } --><\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Une fonction de hash est une fonction qui prend une cha\u00eene de caract\u00e8res en entr\u00e9e et qui renvoi une autre chaine de caract\u00e8res. La cha\u00eene de caract\u00e8res r\u00e9sultat a toujours la m\u00eame longueur et est strictement identique pour une m\u00eame entr\u00e9e.<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Une des utilisations du hashage sert a masquer les mots de passes stock\u00e9s dans une table.<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Au lieu d&rsquo;avoir une table utilisateur, faiblement s\u00e9curis\u00e9e avec un mot de passe en clair:<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------+------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| name     | password_en_clair      |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------+------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| freshdaz | mot_de_passe           |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------+------------------------+<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Il est pr\u00e9f\u00e9rable d&rsquo;avoir ceci, le m\u00eame mot de passe mais hash\u00e9:<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------+---------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| name     | password_hash                         |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------+---------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| freshdaz | 8b70bf2ffce34ced3223dfc9e4fa9cc7      |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------+---------------------------------------+<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Comme vous pouvez le constater le mot de passe hash\u00e9 est plus difficile \u00e0 lire, d&rsquo;autant plus que le hash est (sens\u00e9 \u00eatre) irr\u00e9versible (en fait tout est une question de temps).<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">MySQL propose 5 fonctions de hashage:<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\"><strong>CRC <\/strong>: (contr\u00f4le de redondance cyclique)<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">c&rsquo;est une m\u00e9thode pour contr\u00f4ler l&rsquo;int\u00e9grit\u00e9 des donn\u00e9es, donc hors sujet \ud83d\ude42<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT crc32('mot_de_passe');<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-----------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| crc32('mot_de_passe') |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-----------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">|             965676113 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-----------------------+<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\"><strong>MD5 <\/strong>: (Message Digest 5)<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">tr\u00e8s populaire mais n&rsquo;est donc plus consid\u00e9r\u00e9 comme s\u00fbr au sens cryptographique. Autrement dit, une petite recherche sur le net et vous trouverez facilement des algorithmes pour le cracker.<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT md5('mot_de_passe');<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| md5('mot_de_passe')              |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| 8b70bf2ffce34ced3223dfc9e4fa9cc7 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------+<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\"><strong>SHA1 <\/strong>: (Secure Hash Algorithm )<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Con\u00e7ue par la National Security Agency (NSA)  (est-ce une bonne nouvelle ?) \ud83d\ude00<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Plus s\u00e9curis\u00e9 que le md5.<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT sha1('mot_de_passe');<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| sha1('mot_de_passe')                     |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| d10c988ca61b785f5a7756b5852683d798fe4d92 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\"><strong>PASSWORD<\/strong>:<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Algorithme \u00ab\u00a0maison\u00a0\u00bb de MySQL. Utilis\u00e9 pour stocker les mots de passes des utilisateurs du serveur MySQL.<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT password('mot_de_passe');<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| password('mot_de_passe')                  |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| *C3D87F1C2FADE3F03484FC62E669276C2A37266F |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-------------------------------------------+<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\"><strong>OLD_PASSWORD<\/strong> :<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Ancien algorithme pour stocker les mot de passes des utilisateurs du serveur MySQL. Utilis\u00e9 jusqu&rsquo;\u00e0 la version 4.0.x de MySQL. Il a \u00e9t\u00e9 chang\u00e9 lui aussi pour des raison de s\u00e9curit\u00e9. L\u00e0 encore vous trouverez tr\u00e8s facilement le n\u00e9cessaire pour le cracker.<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT old_password('mot_de_passe');<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| old_password('mot_de_passe') |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| 684ec7590a2271b0             |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------+<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<h3>Quelles fonctions utiliser ?<\/h3>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Comme souvent en informatique, il faut faire un compromis entre meilleurs performances et s\u00e9curit\u00e9 optimale. En d&rsquo;autre terme un sha1 plus s\u00e9curis\u00e9 qu&rsquo;un md5 mettra cependant plus de  temps pour hasher une m\u00eame chaine de caract\u00e8res.<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">V\u00e9rifions tout ceci:<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT md5('olivierdasini');<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| md5('olivierdasini')             |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| a42bc0139343fc758a414f70eda6f209 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">1 row in set (<span style=\"color: #ff0000;\">0.00 sec<\/span>)<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT sha1('olivierdasini');<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| sha1('olivierdasini')                    |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| f2cdbfdf62d717ab96528235a1b1ff34671860d4 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">1 row in set (<span style=\"color: #ff0000;\">0.00 sec<\/span>)<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">hum, hum pas tr\u00e8s probant&#8230;<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Aidons nous de la fonction <a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/information-functions.html#function_benchmark\" target=\"_blank\"><strong><em>benchmark()<\/em><\/strong><\/a>:<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT benchmark(3000000,md5('olivierdasini'));<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-----------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| BENCHMARK(3000000,md5('olivierdasini')) |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-----------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">|                                       0 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-----------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">1 row in set (<span style=\"color: #ff0000;\">12.27 sec<\/span>)<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT benchmark(3000000,sha1('olivierdasini'));<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| BENCHMARK(3000000,sha1('olivierdasini')) |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">|                                        0 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">1 row in set (<span style=\"color: #ff0000;\">15.91 sec<\/span>)<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">En ex\u00e9cutant ces 2 fonctions plusieurs fois, (gr\u00e2ce \u00e0 benchmark()) on s&rsquo;aper\u00e7oit qu&rsquo;il faut  environ 25% de temps suppl\u00e9mentaire pour l&rsquo;algorithme sha1 que pour le md5. Ce qui est loin d&rsquo;\u00eatre n\u00e9gligeable.<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Regardons comment se d\u00e9brouillent les fonctions \u00ab\u00a0maison\u00a0\u00bb de MySQL:<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT benchmark(3000000,password('olivierdasini'));<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| BENCHMARK(3000000,password('olivierdasini')) |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">|                                            0 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+----------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">1 row in set (<span style=\"color: #ff0000;\">7.24 sec<\/span>)<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">17:08 root$test&gt; SELECT benchmark(3000000,old_password('olivierdasini'));<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+--------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| BENCHMARK(3000000,old_password('olivierdasini')) |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+--------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">|                                                0 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+--------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">1 row in set (<span style=\"color: #ff0000;\">4.26 sec<\/span>)<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Le verdict est sans appels, avec ses 7 secondes (pr\u00e8s de 50% de temps en moins que md5 ), la fonction password() est d&rsquo;un bon rapport performance s\u00e9curit\u00e9. Pour rappel, c&rsquo;est cette fonction qu&rsquo;utilise le serveur MySQL pour g\u00e9rer les mots de passes de ses comptes utilisateurs. Inconv\u00e9nient non n\u00e9gligeable, elle est sp\u00e9cifique (\u00e0 ma connaissance) \u00e0 MySQL (mais est-ce vraiment un inconv\u00e9nient ?\u00a0 \ud83d\ude42 ).<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Quant \u00e0 l&rsquo;ancienne fa\u00e7on de hasher les mots de passes, elle est \u00e9videment tr\u00e8s performante, mais on a vu que niveau s\u00e9curit\u00e9, elle laisse \u00e0 d\u00e9sirer&#8230;<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Les fonctions pr\u00e9sent\u00e9es sont une bonne solution pour s\u00e9curiser ses mots de passes. Il est n\u00e9anmoins possible d&rsquo;augmenter encore un peu plus le niveau de s\u00e9curit\u00e9. Une des techniques consiste \u00e0 renforcer le mot de passe utilisateur en lui rajoutant une chaine de caract\u00e8res et en combinant plusieurs algorithmes de hashage.<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Par exemple, avec comme mot de passe: olivierdasini, on peut concat\u00e9ner, avec la fonction concat(),  la date de naissance: 121174_ et combiner diff\u00e9rents algorithmes:<\/p>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">mysql&gt; SELECT benchmark(3000000,md5(concat(sha1('121174_'), 'olivierdasini')));<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| benchmark(3000000,md5(concat(sha1('121174_'), 'olivierdasini'))) |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">|                                                                0 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+------------------------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">1 row in set (<span style=\"color: #ff0000;\">29.30 sec<\/span>)<\/pre>\n<pre style=\"margin-bottom: 0cm; page-break-before: always;\" lang=\"fr-FR\">mysql&gt; SELECT benchmark(3000000,password(concat(old_password('121174_'), 'olivierdasini')));<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-------------------------------------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">| benchmark(3000000,password(concat(old_password('121174_'), 'olivierdasini'))) |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-------------------------------------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">|                                                                             0 |<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">+-------------------------------------------------------------------------------+<\/pre>\n<pre style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">1 row in set (<span style=\"color: #ff0000;\">12.06 sec<\/span>)<\/pre>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">Avec de telles combinaisons, vos mots de passes sont plus \u00e0 l&rsquo;abri, par contre les temps de hashage sont doubl\u00e9s. Comme ont le disait pr\u00e9c\u00e9demment, tout est une histoire de compromis.<\/p>\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n<p style=\"margin-bottom: 0cm;\" lang=\"fr-FR\">\n","protected":false},"excerpt":{"rendered":"<p>Une fonction de hash est une fonction qui prend une cha\u00eene de caract\u00e8res en entr\u00e9e et qui renvoi une autre chaine de caract\u00e8res. La cha\u00eene de caract\u00e8res r\u00e9sultat a toujours la m\u00eame longueur et est strictement identique pour une m\u00eame entr\u00e9e.<\/p>\n<p>Une des utilisations du hashage sert a masquer les mots de passes stock\u00e9s dans une table.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"categories":[8],"tags":[27,241,28],"class_list":["post-76","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-hash","tag-mysql","tag-securite"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9LfWW-1e","jetpack-related-posts":[{"id":1287,"url":"https:\/\/dasini.net\/blog\/2012\/07\/19\/le-mystere-du-concat\/","url_meta":{"origin":76,"position":0},"title":"Le myst\u00e8re du CONCAT","author":"Olivier DASINI","date":"19 juillet 2012","format":false,"excerpt":"Un comportement bizarre m'a \u00e9t\u00e9 remont\u00e9e par un coll\u00e8gue. J'ai une table qui contient des IDs (pas la cl\u00e9 primaire): SELECT DISTINCT ID FROM Connection WHERE...\\G *************************** 1. row *************************** ID: 12345678 J'utilise la fonction CONCAT pour concat\u00e9ner une cha\u00eene de caract\u00e8res et les IDs de la table:","rel":"","context":"Dans &quot;Astuce&quot;","block_context":{"text":"Astuce","link":"https:\/\/dasini.net\/blog\/category\/astuce\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":788,"url":"https:\/\/dasini.net\/blog\/2009\/10\/12\/mysql-query-cache\/","url_meta":{"origin":76,"position":1},"title":"MySQL Query cache","author":"Olivier DASINI","date":"12 octobre 2009","format":false,"excerpt":"Le cache est toujours \u00e0 jour car en cas de modification d'une table, toutes les requ\u00eates en relations avec cette table sont invalid\u00e9es. Le cache de requ\u00eates est en g\u00e9n\u00e9ral utile lorsque: Les modifications sur les tables ne sont pas tr\u00e8s fr\u00e9quentes Beaucoup de requ\u00eates de lectures identiques Utilisation de\u2026","rel":"","context":"Dans &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/dasini.net\/blog\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":137,"url":"https:\/\/dasini.net\/blog\/2008\/11\/16\/enigme-order-by\/","url_meta":{"origin":76,"position":2},"title":"\u00c9nigme&#8230; order by","author":"Olivier DASINI","date":"16 novembre 2008","format":false,"excerpt":"Cela part d'un probl\u00e8me tout simple, trier les donn\u00e9es d'une table: mysql> SELECT id, technologie FROM enigme;","rel":"","context":"Dans &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/dasini.net\/blog\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":691,"url":"https:\/\/dasini.net\/blog\/2009\/07\/29\/utiliser-xml-avec-mysql-5-1-part-25\/","url_meta":{"origin":76,"position":3},"title":"Utiliser XML avec MySQL 5.1 (part 2\/5)","author":"Olivier DASINI","date":"29 juillet 2009","format":false,"excerpt":"Ins\u00e9rer du XML dans MySQL Un fichier XML, n'est finalement qu'un fichier contenant du texte et ins\u00e9rer du texte dans un SGBDR, est loin d'\u00eatre la chose la plus difficile. Une simple requ\u00eate INSERT fait l'affaire. Cela nous donne quelque chose comme ceci : INSERT INTO ma_table (champ_texte) VALUES ('...')","rel":"","context":"Dans &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/dasini.net\/blog\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":237,"url":"https:\/\/dasini.net\/blog\/2008\/11\/28\/les-nouveautes-de-mysql-51-part-15\/","url_meta":{"origin":76,"position":4},"title":"Les nouveaut\u00e9s de MySQL 5.1 &#8212; (part 1\/5)","author":"Olivier DASINI","date":"28 novembre 2008","format":false,"excerpt":"Que de chemin parcouru depuis ce 5 juillet 1999, date de lancement de MySQL 3.23.0. En plus des objectifs de simplicit\u00e9 d'administration, de hautes performances et de fiabilit\u00e9, se sont greff\u00e9es, au fur et \u00e0 mesure, les fonctionnalit\u00e9s les plus demand\u00e9es par les utilisateurs. La nouvelle version du SGBDR open-source\u2026","rel":"","context":"Dans &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/dasini.net\/blog\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":779,"url":"https:\/\/dasini.net\/blog\/2009\/10\/01\/utiliser-xml-avec-mysql-5-1-part-55\/","url_meta":{"origin":76,"position":5},"title":"Utiliser XML avec MySQL 5.1 (part 5\/5)","author":"Olivier DASINI","date":"1 octobre 2009","format":false,"excerpt":"Voil\u00e0 un petit panorama de l'utilisation des fonctionnalit\u00e9s XML de MySQL. Comme nous l'avons vu, g\u00e9n\u00e9rer le r\u00e9sultat d'une requ\u00eate au format XML reste tr\u00e8s simple avec le client texte mysql, idem pour la g\u00e9n\u00e9ration d'une sauvegarde (mysqldump). De plus, bien que n'\u00e9tant pas un base de donn\u00e9es XML, ont\u2026","rel":"","context":"Dans &quot;MySQL&quot;","block_context":{"text":"MySQL","link":"https:\/\/dasini.net\/blog\/category\/mysql\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/76","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/comments?post=76"}],"version-history":[{"count":7,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/76\/revisions"}],"predecessor-version":[{"id":87,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/posts\/76\/revisions\/87"}],"wp:attachment":[{"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/media?parent=76"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/categories?post=76"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dasini.net\/blog\/wp-json\/wp\/v2\/tags?post=76"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}