1<!DOCTYPE html> 2<html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>PHP function md5()</title> 6 <meta name="description" content="Online generator md5 hash of string. Checksum md5. " /> 7 <meta name="keywords" content="php, function, md5, function md5, generator, md5 generator, md5 online, md5 check, md5 checksum" /> 8 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 9 <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/styles/panda-syntax-light.min.css"> 10
10<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/11.6.0/highlight.min.js"></script>
10 11 <!--
11<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
11 --> 12
12<script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
12 13
13<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
13 14
14<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
14 15 <link media="all" rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous" /> 16 <link media="all" rel="stylesheet" href="inc/style3.css?chks=dfb8ab5c3717410c0fd5ffaf106e9393" crossorigin="anonymous"/> 17 <!-- Font Awesome --> 18 <link rel="stylesheet" href="/inc/fontawesome-free/css/all.min.css"> 19 <!-- Google Tag Manager --> 20
20<script>
vendor: 359 bytes, lines 20-24
20(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 21 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 22 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 23 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 24 })(window,document,'script','dataLayer','
24GTM-W99BN27
vendor: 3 bytes, line 24
24');
24</script>
24 25 <!-- End Google Tag Manager --> 26 27 28 <!-- Google AdSense --> 29
29<script async custom-element="amp-auto-ads" src="https://cdn.ampproject.org/v0/amp-auto-ads-0.1.js"></script>
29 30
30<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-7492776353891642" crossorigin="anonymous"></script>
30 31 <!-- End Google AdSense --> </head> 32 <body> 33 34 <main class="container"> 35 <div class="row justify-content-md-center"> 36 <h1 class="col text-center"><a href="/"><i class="fa fa-home pr-4"></i>function md5()</a></h1> 37 </div> 38 <div class="row justify-content-md-center py-4"> 39 <h2 class="col text-center ">Using MD5 algorithm in PHP</h2> 40</div> 41<article class="row"> 42 43 <div class="col-12">Using the MD5 algorithm in PHP is very easy because it has a native md5() function.</div> 44 45 46 <div class="col-12 mt-4"><h3>Syntax (>= PHP 4):</h3> 47 <pre><code class="language-php">md5(string $string, bool $binary = false): string</code></pre> 48 </div> 49 50 <div class="col-12"> 51 52 <h3>Basic example:</h3> 53 <pre><code class="language-php"><?php 54$str = "Hello world!"; 55echo md5($str); 56?></code></pre></div> 57 58 59 <div class="col-12"><h4>The above example will output:</h4> 60 <pre><code class="language-plaintext">86fb269d190d2c85f6e0468ceca42a20</code></pre> 61 </div> 62 63 <div class="col-12 mt-2"> 64 65 <amp-ad width="100vw" height="320" 66 type="adsense" 67 data-ad-client="ca-pub-7492776353891642" 68 data-ad-slot="8935191590" 69 data-auto-format="rspv" 70 data-full-width=""> 71 <div overflow=""></div> 72 </amp-ad> 73 74 </div> 75 76 77 <div class="col-12 mt-4"> 78 <h3>Example #2 with parameter <code>$binary</code> set to <code>TRUE</code>:</h3> 79 <p>The PHP function also has a second optional parameter <code>$binary</code> (default value = <code>FALSE</code>). When this parameter is set to true, the md5 hash string is returned in raw binary format with a length of 16.</p> 80 <pre><code class="language-php"><?php 81$str = "Hello world!"; 82echo md5($str, true); 83?></code></pre></div> 84 85 <div class="col-12"><h4>Example #2 will output (unreadable in the browser):</h4> 86 <pre><code class="language-plaintext">û&��, öàFì¤* </code></pre> 87 </div> 88 89 <div class="col-12 mt-4"> 90 <h3>Example #3 with $salt before string to be encrypted:</h3> 91 <p>In some cases, it is worth using a salted MD5 hash for added security. This means that you add the string "salt" before or after the string to be encrypted.</p> 92 <pre><code class="language-php"><?php 93$salt = "i#8^*uu"; //your arbitrary secret key 94$str = "Hello world!"; 95echo md5($salt . $str, true); 96?></code></pre></div> 97 98 <div class="col-12"><h4>Example #3 will output:</h4> 99 <pre><code class="language-plaintext">5e5eb686808a7c39710dccf1ce03a4e6</code></pre> 100 </div> 101 102 103 <div class="col-12 externalSources"> 104 <h3>External resources about MD5 in PHP:</h3> 105 <a href="https://www.php.net/manual/en/function.md5.php" target="_blank"><i class="fas fa-external-link-alt" aria-hidden="true"></i> PHP.net</a> 106 <a href="https://www.w3resource.com/mysql/encryption-and-compression-functions/md5().php" target="_blank"><i class="fa fa-external-link-alt" aria-hidden="true"></i> w3resource</a> 107 </ul> 108 </div> 109 110</article> </main> 111 <footer> 112 <hr> 113 <div class="row content-md-center mt-2 pt-2"> 114 <div class="col-sm-12 text-center"><small>Implementations MD5:</small></div> 115 </div> 116 <div class="links row"> 117 <div class="col-sm-12 text-center"> 118 <a href="/php-md5" title="string md5 ( string $str [, bool $raw_output ] )">md5() in PHP</a> <small>|</small> 119 <a href="/javascript-md5" title="MD5 Implementation in JavaScript">md5 in JavaScript</a> <small>|</small> 120 <a href="/mysql-md5" title="MySQL: function MD5">md5() in MySQL</a> <small>|</small> 121 <a href="/mariadb-md5" title="MariaDB: function MD5">md5() in MariaDB</a> <small>|</small> 122 <a href="/t-sql-md5" title="T-SQL: function MD5">md5 in T-SQL</a> <small>|</small> 123 <a href="/python-md5" title="MD5 hash in Python">md5 in Python</a> 124 </div> 125 </div> 126 <div class="links row"> 127 <div class="col-sm-12 text-center"> 128 <a href="http://en.wikipedia.org/wiki/Md5" target="_blank" title="MD5 (Message-Digest algorithm 5) on Wikipedia.org">MD5 on Wikipedia.org</a> 129 </div> 130 </div> 131 </footer> 132 <!--
133<script src="/inc/jquery.ihavecookies.min.js?chks=553776daa8b78b0b632803f19660b0c2"></script>
133 134 <link media="all" rel="stylesheet" href="/inc/ihavecookies.css?chks=24a6fe0583fde7f6a405385f125965c1" crossorigin="anonymous"/> 135
135<script> 136 $('document').ready(function(){ 137 ihavecookiesInit(); 138 }); 139 140 ihavecookiesInit = function() { 141 if (typeof($('body').ihavecookies) != 'function') { return; } 142 143 var options = { 144 message: "Cookies enable you to personalize your experience on our sites, tell us which parts of our websites people have visited, help us measure the effectiveness of ads and web searches, and give us insights into user behavior so we can improve our communications." 145 , link : "#" 146 } 147 $('body').ihavecookies(options, ''); 148 }; 149 </script>
149 150-->
150<script>hljs.highlightAll();</script>
150 151 <!--
151<script data-cfasync="false" type="text/javascript" data-adel="atag" src="//acscdn.com/script/atg.js" czid="m2zubc2fp1"></script>
151 --> </body> 152</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.