string crypt function - generates and returns encrypted string

string crypt function - generates and returns encrypted string

how-to-generate-encrypted-string-using-crypt-function-in-php.php


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <title>string crypt function - generates and returns encrypted string</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <meta name="Author" content="Md Iqbal Hosan">
  <meta name="title" content="string crypt function - generates and returns encrypted string">
  <meta name="keywords" content="php, example, code, array, function, crypt, string">
  <meta name="description" content="string crypt function - generates and returns encrypted string">
  <style>
   h2, h4{background:#eee; color:#000084;}
   h2{ padding:3px; margin:3px; font-size:21px;}
   h4{ padding:2px; margin:2px; font-size:17px;}
   p{padding:2px; margin:2px; color:#0066dd;}
   body{ background:#FFFFFb;}
  </style>
 </head>
 <body>
  <h2>string crypt function - generates and returns encrypted string</h2>
  <pre>
   <?php
    /*
     ----------------------------------
     let us make a password string
     ----------------------------------
    */
    $myNormalPassword = "mypassword*321#";
    echo "<h4>Output of myNormalPassword String</h4>";
    print "<p>$"."myNormalPassword = {$myNormalPassword}</p>";
    print "<p>string length : ".strlen($myNormalPassword)."</p>";
    /*
     ----------------------------------------------------------------------------
     now i want myNormalPassword to be encrypted by using crypt string function
     ----------------------------------------------------------------------------
    */
    $encryptedPassword = crypt($myNormalPassword);
    echo "<h4>Output of encryptedPassword by using string crypt function</h4>";
    print "<p>$"."encryptedPassword = {$encryptedPassword}</p>";
    print "<p>string length : ".strlen($encryptedPassword)."</p>";
    /*
     -----------------------------------------------------------
     this function is useful to make one way encription in php
     -----------------------------------------------------------
    */
   ?>
  </pre>
 </body>
</html>


string crypt function - generates and returns encrypted string - output in the browser

No comments:

Post a Comment

leave your comments here..