In PHP for example, you need to use the point symbol to concatenate two strings:<\/strong><\/p>\n\n\n\n<?php\n$salt = \"randomstringforsalt\";\n$password = $_POST['password'];\n\n$md5 = md5($salt.$password);\n?><\/pre>\n\n\n\n<\/span>It’s that simple.
Don’t forget to use a long salt, or even better a dynamic salt.
If your salt is “1234” it’s like you didn’t use one (azerty or azerty1234 are two weak passwords).<\/p>\n\n\n\n<\/span>Conclusion<\/span><\/h2>\n\n\n\nThat’s it, you now know how to use MD5 salt in your code, and why it’s so important if you want to stay with an MD5 encryption method.<\/p>\n\n\n\n
But if you can, it’s probably the best option to choose another algorithm.
In PHP, you have the password_hash() function, or you can also use bcrypt or scrypt to get a safer password in your database.<\/p>\n\n\n\n
But it’s a good thing to have learned what is salt and how to use it, as you can use salt with any cryptographic algorithm.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"You probably already know that MD5 hashing is not a secure way to store passwords.If you know our services, you probably know that\u00a0we have a giant database with many words, that can be decrypted in a few seconds.By using salt, you could protect yourself a bit\u00a0more against this kind of database, but not so much…<\/p>\n","protected":false},"author":1,"featured_media":75,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_kad_blocks_custom_css":"","_kad_blocks_head_custom_js":"","_kad_blocks_body_custom_js":"","_kad_blocks_footer_custom_js":"","_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[14],"tags":[],"taxonomy_info":{"category":[{"value":14,"label":"Security"}]},"featured_image_src_large":["https:\/\/infosecscout.com\/wp-content\/uploads\/2019\/02\/Vignette-MD5-3.png",292,133,false],"author_info":{"display_name":"Patrick Fromaget","author_link":"https:\/\/infosecscout.com\/about\/"},"comment_info":0,"category_info":[{"term_id":14,"name":"Security","slug":"security","term_group":0,"term_taxonomy_id":14,"taxonomy":"category","description":"Check out our easy-to-follow tips and facts in Security Information. Learn how passwords work and more, all explained in a way that's easy to understand.","parent":0,"count":21,"filter":"raw","cat_ID":14,"category_count":21,"category_description":"Check out our easy-to-follow tips and facts in Security Information. Learn how passwords work and more, all explained in a way that's easy to understand.","cat_name":"Security","category_nicename":"security","category_parent":0}],"tag_info":false,"_links":{"self":[{"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/posts\/42"}],"collection":[{"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":10,"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":243,"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/posts\/42\/revisions\/243"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/media\/75"}],"wp:attachment":[{"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infosecscout.com\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}