{"id":5782,"date":"2019-02-08T06:28:30","date_gmt":"2019-02-08T06:28:30","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=5782"},"modified":"2021-11-17T08:42:02","modified_gmt":"2021-11-17T08:42:02","slug":"password-hashing-in-php","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/password-hashing-in-php\/","title":{"rendered":"Password Hashing in PHP"},"content":{"rendered":"<p>Functions for hashing password<\/p>\n<ul>\n<li>password_hash()<\/li>\n<li>password_verify()<\/li>\n<\/ul>\n<p><strong>password_hash() \u2013<\/strong><\/p>\n<p><strong>Syntax:<\/strong><br>\n[code language=&#8221;php&#8221;]<br>\nstring password_hash(string $password , integer $algo [, array $options ] )<br>\n[\/code]<\/p>\n<p><strong>string $password<\/strong> \u2013 Password provide by user<br>\n<strong>integer $algo<\/strong> \u2013   Password algorithm constant(PASSWORD_DEFAULT and PASSWORD_BCRYPT)<br>\n<strong>PASSWORD_DEFAULT<\/strong> \u2013 uses the BCrypt algorithm to create the hash<br>\n<strong>PASSWORD_BCRYPT<\/strong> \u2013  uses the CRYPT_BLOWFISH algorithm and will return a 60 character string<br>\n<strong>$options<\/strong> \u2013 $options have two indexes.One is cost and another one is <strong>salt<\/strong>.<br>\n<strong>Cost<\/strong>&#8211;  Cost is the repetition of algorithm which have default value 10.  Which means algorithm will run 10 times to make a strong hash. You can configure your cost value according to your server configuration.<br>\n<strong>Syntax- <\/strong><br>\n[code language=&#8221;php&#8221;]<br>\n&lt;?php<br>\n$password=$_POST[&#8216;password&#8217;];<br>\n$options = array(<br>\n&#8216;salt&#8217; =&gt; mcrypt_create_iv(22, MCRYPT_DEV_URANDOM),<br>\n&#8216;cost&#8217; =&gt; 12,<br>\n);<br>\n$hashedpass=password_hash($password, PASSWORD_BCRYPT, $options);<br>\n?&gt;<br>\n[\/code]<\/p>\n<p><strong>password_verify() <\/strong><br>\npassword_verify() used for checking a password against a password hash, then return a boolean.<br>\n[code language=&#8221;php&#8221;]<br>\nif (password_verify($passowrd, $hashedpass)) {<br>\necho &#8216;Password is valid!&#8217;;<br>\n} else {<br>\necho &#8216;Invalid password.&#8217;;<br>\n}<br>\n[\/code]<\/p>\n<p><strong>Example \u2013<\/strong><\/p>\n<p><strong>Signup.php<\/strong><br>\n[code language=&#8221;php&#8221;]<br>\n&lt;?php<br>\n\/\/Database Configuration File<br>\ninclude(&#8216;config.php&#8217;);<br>\n\/\/error_reporting(0);<br>\nif(isset($_POST[&#8216;signup&#8217;]))<br>\n{<br>\n\/\/Getting Post Values<br>\n$fullname=$_POST[&#8216;fname&#8217;];<br>\n$username=$_POST[&#8216;username&#8217;];<br>\n$email=$_POST[&#8217;email&#8217;];<br>\n$mobile=$_POST[&#8216;mobilenumber&#8217;];<br>\n\/\/Password hashing<br>\n$password=$_POST[&#8216;password&#8217;];<br>\n$options = [&#8216;cost&#8217; =&gt; 12];<br>\n$hashedpass=password_hash($password, PASSWORD_BCRYPT, $options);<br>\n\/\/ Query for validation of username and email-id<br>\n$ret=&#8221;SELECT * FROM userdata where (UserName=:uname ||  UserEmail=:uemail)&#8221;;<br>\n$queryt = $dbh -&gt; prepare($ret);<br>\n$queryt-&gt;bindParam(&#8216;:uemail&#8217;,$email,PDO::PARAM_STR);<br>\n$queryt-&gt;bindParam(&#8216;:uname&#8217;,$username,PDO::PARAM_STR);<br>\n$queryt -&gt; execute();<br>\n$results = $queryt -&gt; fetchAll(PDO::FETCH_OBJ);<br>\nif($queryt -&gt; rowCount() == 0)<br>\n{<br>\n\/\/ Query for Insertion<br>\n$sql=&#8221;INSERT INTO userdata(FullName,UserName,UserEmail,UserMobileNumber,LoginPassword) VALUES(:fname,:uname,:uemail,:umobile,:upassword)&#8221;;<br>\n$query = $dbh-&gt;prepare($sql);<br>\n\/\/ Binding Post Values<br>\n$query-&gt;bindParam(&#8216;:fname&#8217;,$fullname,PDO::PARAM_STR);<br>\n$query-&gt;bindParam(&#8216;:uname&#8217;,$username,PDO::PARAM_STR);<br>\n$query-&gt;bindParam(&#8216;:uemail&#8217;,$email,PDO::PARAM_STR);<br>\n$query-&gt;bindParam(&#8216;:umobile&#8217;,$mobile,PDO::PARAM_INT);<br>\n$query-&gt;bindParam(&#8216;:upassword&#8217;,$hashedpass,PDO::PARAM_STR);<br>\n$query-&gt;execute();<br>\n$lastInsertId = $dbh-&gt;lastInsertId();<br>\nif($lastInsertId)<br>\n{<br>\n$msg=&#8221;You have signup  Scuccessfully&#8221;;<br>\n}<br>\nelse<br>\n{<br>\n$error=&#8221;Something went wrong.Please try again&#8221;;<br>\n}<br>\n}<br>\nelse<br>\n{<br>\n$error=&#8221;Username or Email-id already exist. Please try again&#8221;;<br>\n}<br>\n}<br>\n?&gt;<br>\n&lt;!DOCTYPE html&gt;<br>\n&lt;html lang=&#8221;en&#8221;&gt;<br>\n&lt;head&gt;<br>\n&lt;meta charset=&#8221;utf-8&#8243;&gt;<br>\n&lt;title&gt;PDO | Registration Form&lt;\/title&gt;<br>\n&lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1&#8243;&gt;<br>\n&lt;link href=&#8221;http:\/\/netdna.bootstrapcdn.com\/twitter-bootstrap\/2.3.2\/css\/bootstrap-combined.min.css&#8221; rel=&#8221;stylesheet&#8221;&gt;<br>\n&lt;script src=&#8221;http:\/\/code.jquery.com\/jquery-1.11.1.min.js&#8221;&gt;&lt;\/script&gt;<br>\n&lt;script src=&#8221;http:\/\/netdna.bootstrapcdn.com\/twitter-bootstrap\/2.3.2\/js\/bootstrap.min.js&#8221;&gt;&lt;\/script&gt;<br>\n&lt;style&gt;<br>\n.errorWrap {<br>\npadding: 10px;<br>\nmargin: 0 0 20px 0;<br>\nbackground: #fff;<br>\nborder-left: 4px solid #dd3d36;<br>\n-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);<br>\nbox-shadow: 0 1px 1px 0 rgba(0,0,0,.1);<br>\n}<br>\n.succWrap{<br>\npadding: 10px;<br>\nmargin: 0 0 20px 0;<br>\nbackground: #fff;<br>\nborder-left: 4px solid #5cb85c;<br>\n-webkit-box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);<br>\nbox-shadow: 0 1px 1px 0 rgba(0,0,0,.1);<br>\n}<br>\n&lt;\/style&gt;<br>\n&lt;!&#8211;Javascript for check username availability&#8211;&gt;<br>\n&lt;script&gt;<br>\nfunction checkUsernameAvailability() {<br>\n$(&#8220;#loaderIcon&#8221;).show();<br>\njQuery.ajax({<br>\nurl: &#8220;check_availability.php&#8221;,<br>\ndata:&#8217;username=&#8217;+$(&#8220;#username&#8221;).val(),<br>\ntype: &#8220;POST&#8221;,<br>\nsuccess:function(data){<br>\n$(&#8220;#username-availability-status&#8221;).html(data);<br>\n$(&#8220;#loaderIcon&#8221;).hide();<br>\n},<br>\nerror:function (){<br>\n}<br>\n});<br>\n}<br>\n&lt;\/script&gt;<br>\n&lt;!&#8211;Javascript for check email availability&#8211;&gt;<br>\n&lt;script&gt;<br>\nfunction checkEmailAvailability() {<br>\n$(&#8220;#loaderIcon&#8221;).show();<br>\njQuery.ajax({<br>\nurl: &#8220;check_availability.php&#8221;,<br>\ndata:&#8217;email=&#8217;+$(&#8220;#email&#8221;).val(),<br>\ntype: &#8220;POST&#8221;,<br>\nsuccess:function(data){<br>\n$(&#8220;#email-availability-status&#8221;).html(data);<br>\n$(&#8220;#loaderIcon&#8221;).hide();<br>\n},<br>\nerror:function (){<br>\nevent.preventDefault();<br>\n}<br>\n});<br>\n}<br>\n&lt;\/script&gt;<br>\n&lt;\/head&gt;<br>\n&lt;body&gt;<br>\n&lt;form class=&#8221;form-horizontal&#8221; action=&#8221; method=&#8221;post&#8221;&gt;<br>\n&lt;fieldset&gt;<br>\n&lt;div id=&#8221;legend&#8221; style=&#8221;padding-left:4%&#8221;&gt;<br>\n&lt;legend class=&#8221;&#8221;&gt;Register | &lt;a href=&#8221;index.php&#8221;&gt;Sign in&lt;\/a&gt;&lt;\/legend&gt;<br>\n&lt;\/div&gt;<br>\n&lt;!&#8211;Error Message&#8211;&gt;<br>\n&lt;?php if($error){ ?&gt;&lt;div class=&#8221;errorWrap&#8221;&gt;<br>\n&lt;strong&gt;Error &lt;\/strong&gt; : &lt;?php echo htmlentities($error);?&gt;&lt;\/div&gt;<br>\n&lt;?php } ?&gt;<br>\n&lt;!&#8211;Success Message&#8211;&gt;<br>\n&lt;?php if($msg){ ?&gt;&lt;div class=&#8221;succWrap&#8221;&gt;<br>\n&lt;strong&gt;Well Done &lt;\/strong&gt; : &lt;?php echo htmlentities($msg);?&gt;&lt;\/div&gt;<br>\n&lt;?php } ?&gt;<br>\n&lt;div class=&#8221;control-group&#8221;&gt;<br>\n&lt;!&#8211; Full name &#8211;&gt;<br>\n&lt;label class=&#8221;control-label&#8221;  for=&#8221;fullname&#8221;&gt;Full Name&lt;\/label&gt;<br>\n&lt;div class=&#8221;controls&#8221;&gt;<br>\n&lt;input type=&#8221;text&#8221; id=&#8221;fname&#8221; name=&#8221;fname&#8221;  pattern=&#8221;[a-zA-Z\\s]+&#8221; title=&#8221;Full name must contain letters only&#8221; class=&#8221;input-xlarge&#8221; required&gt;<br>\n&lt;p class=&#8221;help-block&#8221;&gt;Full can contain any letters only&lt;\/p&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;control-group&#8221;&gt;<br>\n&lt;!&#8211; Username &#8211;&gt;<br>\n&lt;label class=&#8221;control-label&#8221;  for=&#8221;username&#8221;&gt;Username&lt;\/label&gt;<br>\n&lt;div class=&#8221;controls&#8221;&gt;<br>\n&lt;input type=&#8221;text&#8221; id=&#8221;username&#8221; name=&#8221;username&#8221; onBlur=&#8221;checkUsernameAvailability()&#8221;  pattern=&#8221;^[a-zA-Z][a-zA-Z0-9-_.]{5,12}$&#8221; title=&#8221;User must be alphanumeric without spaces 6 to 12 chars&#8221; class=&#8221;input-xlarge&#8221; required&gt;<br>\n&lt;span id=&#8221;username-availability-status&#8221; style=&#8221;font-size:12px;&#8221;&gt;&lt;\/span&gt;<br>\n&lt;p class=&#8221;help-block&#8221;&gt;Username can contain any letters or numbers, without spaces 6 to 12 chars &lt;\/p&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;control-group&#8221;&gt;<br>\n&lt;!&#8211; E-mail &#8211;&gt;<br>\n&lt;label class=&#8221;control-label&#8221; for=&#8221;email&#8221;&gt;E-mail&lt;\/label&gt;<br>\n&lt;div class=&#8221;controls&#8221;&gt;<br>\n&lt;input type=&#8221;email&#8221; id=&#8221;email&#8221; name=&#8221;email&#8221; placeholder=&#8221;&#8221; onBlur=&#8221;checkEmailAvailability()&#8221; class=&#8221;input-xlarge&#8221; required&gt;<br>\n&lt;span id=&#8221;email-availability-status&#8221; style=&#8221;font-size:12px;&#8221;&gt;&lt;\/span&gt;<br>\n&lt;p class=&#8221;help-block&#8221;&gt;Please provide your E-mail&lt;\/p&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;control-group&#8221;&gt;<br>\n&lt;!&#8211; Mobile Number &#8211;&gt;<br>\n&lt;label class=&#8221;control-label&#8221; for=&#8221;mobilenumber&#8221;&gt;Mobile Number &lt;\/label&gt;<br>\n&lt;div class=&#8221;controls&#8221;&gt;<br>\n&lt;input type=&#8221;text&#8221; id=&#8221;mobilenumber&#8221; name=&#8221;mobilenumber&#8221; pattern=&#8221;[0-9]{10}&#8221; maxlength=&#8221;10&#8243;  title=&#8221;10 numeric digits only&#8221;   class=&#8221;input-xlarge&#8221; required&gt;<br>\n&lt;p class=&#8221;help-block&#8221;&gt;Mobile Number Contain only 10 digit numeric values&lt;\/p&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;control-group&#8221;&gt;<br>\n&lt;!&#8211; Password&#8211;&gt;<br>\n&lt;label class=&#8221;control-label&#8221; for=&#8221;password&#8221;&gt;Password&lt;\/label&gt;<br>\n&lt;div class=&#8221;controls&#8221;&gt;<br>\n&lt;input type=&#8221;password&#8221; id=&#8221;password&#8221; name=&#8221;password&#8221; pattern=&#8221;^\\S{4,}$&#8221; onchange=&#8221;this.setCustomValidity(this.validity.patternMismatch ? &#8216;Must have at least 4 characters&#8217; : &#8221;); if(this.checkValidity()) form.password_two.pattern = this.value;&#8221;  required class=&#8221;input-xlarge&#8221;&gt;<br>\n&lt;p class=&#8221;help-block&#8221;&gt;Password should be at least 4 characters&lt;\/p&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;control-group&#8221;&gt;<br>\n&lt;!&#8211; Confirm Password &#8211;&gt;<br>\n&lt;label class=&#8221;control-label&#8221;  for=&#8221;password_confirm&#8221;&gt;Password (Confirm)&lt;\/label&gt;<br>\n&lt;div class=&#8221;controls&#8221;&gt;<br>\n&lt;input type=&#8221;password&#8221; id=&#8221;password_confirm&#8221; name=&#8221;password_confirm&#8221; pattern=&#8221;^\\S{4,}$&#8221; onchange=&#8221;this.setCustomValidity(this.validity.patternMismatch ? &#8216;Please enter the same Password as above&#8217; : &#8221;)&#8221;&#8221;  class=&#8221;input-xlarge&#8221;&gt;<br>\n&lt;p class=&#8221;help-block&#8221;&gt;Please confirm password&lt;\/p&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;control-group&#8221;&gt;<br>\n&lt;!&#8211; Button &#8211;&gt;<br>\n&lt;div class=&#8221;controls&#8221;&gt;<br>\n&lt;button class=&#8221;btn btn-success&#8221; type=&#8221;submit&#8221; name=&#8221;signup&#8221;&gt;Signup &lt;\/button&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/fieldset&gt;<br>\n&lt;\/form&gt;<br>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br>\n&lt;\/script&gt;<br>\n&lt;\/body&gt;<br>\n&lt;\/html&gt;<br>\n[\/code]<\/p>\n<p><strong>index.php (login page)<\/strong><br>\n[code language=&#8221;php&#8221;]<br>\n&lt;?php<br>\nsession_start();<br>\n\/\/Database Configuration File<br>\ninclude(&#8216;config.php&#8217;);<br>\nerror_reporting(0);<br>\nif(isset($_POST[&#8216;login&#8217;]))<br>\n{<br>\n\/\/ Getting username\/ email and password<br>\n$uname=$_POST[&#8216;username&#8217;];<br>\n$password=$_POST[&#8216;password&#8217;];<br>\n\/\/ Fetch data from database on the basis of username\/email and password<br>\n$sql =&#8221;SELECT UserName,UserEmail,LoginPassword FROM userdata WHERE (UserName=:usname || UserEmail=:usname)&#8221;;<br>\n$query= $dbh -&gt; prepare($sql);<br>\n$query-&gt; bindParam(&#8216;:usname&#8217;, $uname, PDO::PARAM_STR);<br>\n$query-&gt; execute();<br>\n$results=$query-&gt;fetchAll(PDO::FETCH_OBJ);<br>\nif($query-&gt;rowCount() &gt; 0)<br>\n{<br>\nforeach ($results as $row) {<br>\n$hashpass=$row-&gt;LoginPassword;<br>\n}<br>\n\/\/verifying Password<br>\nif (password_verify($password, $hashpass)) {<br>\n$_SESSION[&#8216;userlogin&#8217;]=$_POST[&#8216;username&#8217;];<br>\necho &#8220;&lt;script type=&#8217;text\/javascript&#8217;&gt; document.location = &#8216;welcome.php&#8217;; &lt;\/script&gt;&#8221;;<br>\n} else {<br>\necho &#8220;&lt;script&gt;alert(&#8216;Wrong Password&#8217;);&lt;\/script&gt;&#8221;;<br>\n}<br>\n}<br>\n\/\/if username or email not found in database<br>\nelse{<br>\necho &#8220;&lt;script&gt;alert(&#8216;User not registered with us&#8217;);&lt;\/script&gt;&#8221;;<br>\n}<br>\n}<br>\n?&gt;<br>\n&lt;!DOCTYPE html&gt;<br>\n&lt;html lang=&#8221;en&#8221;&gt;<br>\n&lt;head&gt;<br>\n&lt;meta charset=&#8221;utf-8&#8243;&gt;<br>\n&lt;!&#8211; This file has been downloaded from Bootsnipp.com. Enjoy! &#8211;&gt;<br>\n&lt;title&gt;PDO | Login form&lt;\/title&gt;<br>\n&lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1&#8243;&gt;<br>\n&lt;link href=&#8221;http:\/\/netdna.bootstrapcdn.com\/bootstrap\/3.2.0\/css\/bootstrap.min.css&#8221; rel=&#8221;stylesheet&#8221;&gt;<br>\n&lt;script src=&#8221;http:\/\/code.jquery.com\/jquery-1.11.1.min.js&#8221;&gt;&lt;\/script&gt;<br>\n&lt;script src=&#8221;http:\/\/netdna.bootstrapcdn.com\/bootstrap\/3.2.0\/js\/bootstrap.min.js&#8221;&gt;&lt;\/script&gt;<br>\n&lt;\/head&gt;<br>\n&lt;body&gt;<br>\n&lt;link href=&#8221;\/\/maxcdn.bootstrapcdn.com\/font-awesome\/4.1.0\/css\/font-awesome.min.css&#8221; rel=&#8221;stylesheet&#8221;&gt;<br>\n&lt;div id=&#8221;login-overlay&#8221; class=&#8221;modal-dialog&#8221;&gt;<br>\n&lt;div class=&#8221;modal-content&#8221;&gt;<br>\n&lt;div class=&#8221;modal-header&#8221;&gt;<br>\n&lt;h4 class=&#8221;modal-title&#8221; id=&#8221;myModalLabel&#8221;&gt;Login Form&lt;\/h4&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;modal-body&#8221;&gt;<br>\n&lt;div class=&#8221;row&#8221;&gt;<br>\n&lt;div class=&#8221;col-xs-6&#8243;&gt;<br>\n&lt;div class=&#8221;well&#8221;&gt;<br>\n&lt;form id=&#8221;loginForm&#8221; method=&#8221;post&#8221;&gt;<br>\n&lt;div class=&#8221;form-group&#8221;&gt;<br>\n&lt;label for=&#8221;username&#8221; class=&#8221;control-label&#8221;&gt;Username \/ Email id&lt;\/label&gt;<br>\n&lt;input type=&#8221;text&#8221; class=&#8221;form-control&#8221; id=&#8221;username&#8221; name=&#8221;username&#8221;  required=&#8221;&#8221; title=&#8221;Please enter you username or Email-id&#8221; placeholder=&#8221;email or username&#8221; &gt;<br>\n&lt;span class=&#8221;help-block&#8221;&gt;&lt;\/span&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;form-group&#8221;&gt;<br>\n&lt;label for=&#8221;password&#8221; class=&#8221;control-label&#8221;&gt;Password&lt;\/label&gt;<br>\n&lt;input type=&#8221;password&#8221; class=&#8221;form-control&#8221; id=&#8221;password&#8221; name=&#8221;password&#8221; placeholder=&#8221;Password&#8221; value=&#8221;&#8221; required=&#8221;&#8221; title=&#8221;Please enter your password&#8221;&gt;<br>\n&lt;span class=&#8221;help-block&#8221;&gt;&lt;\/span&gt;<br>\n&lt;\/div&gt;<br>\n&lt;button type=&#8221;submit&#8221; class=&#8221;btn btn-success btn-block&#8221; name=&#8221;login&#8221;&gt;Login&lt;\/button&gt;<br>\n&lt;\/form&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;div class=&#8221;col-xs-6&#8243;&gt;<br>\n&lt;p class=&#8221;lead&#8221;&gt;Register now for &lt;span class=&#8221;text-success&#8221;&gt;FREE&lt;\/span&gt;&lt;\/p&gt;<br>\n&lt;ul class=&#8221;list-unstyled&#8221; style=&#8221;line-height: 2&#8243;&gt;<br>\n&lt;li&gt;&lt;span class=&#8221;fa fa-check text-success&#8221;&gt;&lt;\/span&gt; Lorem ipsum dolor sit amet&lt;\/li&gt;<br>\n&lt;li&gt;&lt;span class=&#8221;fa fa-check text-success&#8221;&gt;&lt;\/span&gt;Lorem ipsum dolor sit amet&lt;\/li&gt;<br>\n&lt;li&gt;&lt;span class=&#8221;fa fa-check text-success&#8221;&gt;&lt;\/span&gt;Lorem ipsum dolor sit amet&lt;\/li&gt;<br>\n&lt;li&gt;&lt;span class=&#8221;fa fa-check text-success&#8221;&gt;&lt;\/span&gt;Lorem ipsum dolor sit amet&lt;\/li&gt;<br>\n&lt;li&gt;&lt;span class=&#8221;fa fa-check text-success&#8221;&gt;&lt;\/span&gt; Lorem ipsum dolor sit amet&lt;\/li&gt;<br>\n&lt;\/ul&gt;<br>\n&lt;p&gt;&lt;a href=&#8221;signup.php&#8221; class=&#8221;btn btn-info btn-block&#8221;&gt;Yes please, register now!&lt;\/a&gt;&lt;\/p&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;\/div&gt;<br>\n&lt;script type=&#8221;text\/javascript&#8221;&gt;<br>\n&lt;\/script&gt;<br>\n&lt;\/body&gt;<br>\n&lt;\/html&gt;<br>\n[\/code]<\/p>\n\n<div class=\"epyt-gallery\" data-currpage=\"1\" id=\"epyt_gallery_14358\"><figure class=\"wp-block-embed wp-block-embed-youtube is-type-video is-provider-youtube epyt-figure\"><div class=\"wp-block-embed__wrapper\"><iframe loading=\"lazy\"  id=\"_ytid_17358\"  width=\"760\" height=\"427\"  data-origwidth=\"760\" data-origheight=\"427\" src=\"https:\/\/www.youtube.com\/embed\/?enablejsapi=1&#038;autoplay=0&#038;cc_load_policy=0&#038;cc_lang_pref=&#038;iv_load_policy=1&#038;loop=0&#038;rel=1&#038;fs=1&#038;playsinline=0&#038;autohide=2&#038;theme=dark&#038;color=red&#038;controls=1&#038;disablekb=0&#038;\" class=\"__youtube_prefs__  no-lazyload\" title=\"YouTube player\"  data-epytgalleryid=\"epyt_gallery_14358\"  allow=\"fullscreen; accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen data-no-lazy=\"1\" data-skipgform_ajax_framebjll=\"\"><\/iframe><\/div><\/figure><div class=\"epyt-gallery-list\"><div>Sorry, there was a YouTube error.<\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>Functions for hashing password password_hash() password_verify() password_hash() \u2013 Syntax: [code language=&#8221;php&#8221;] string password_hash(string $password , integer $algo [, array $options ] ) [\/code] string $password \u2013 Password provide by user integer $algo \u2013 Password algorithm constant(PASSWORD_DEFAULT and PASSWORD_BCRYPT) PASSWORD_DEFAULT \u2013 uses the BCrypt algorithm to create the hash PASSWORD_BCRYPT \u2013 uses the CRYPT_BLOWFISH algorithm and&#8230;<\/p>\n","protected":false},"author":2,"featured_media":8049,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_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,"_kad_post_classname":"","_joinchat":[],"footnotes":""},"categories":[5150],"tags":[5192,534,5176,177],"class_list":["post-5782","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-php","tag-hashing","tag-password","tag-pdo","tag-php"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=5782"}],"version-history":[{"count":3,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5782\/revisions"}],"predecessor-version":[{"id":25550,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/5782\/revisions\/25550"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media\/8049"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=5782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=5782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=5782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}