Advertisement
icorrelate

PHP hash() function

Oct 28th, 2016
247
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.08 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>Hash Algorithms</title>
  5.     <style>
  6.         table {
  7.             font-family: arial, sans-serif;
  8.             border-collapse: collapse;
  9.             width: 100%;
  10.         }
  11.  
  12.         td, th {
  13.             border: 1px solid #dddddd;
  14.             text-align: left;
  15.             padding: 8px;
  16.         }
  17.  
  18.         tr:nth-child(even) {
  19.             background-color: #dddddd;
  20.         }
  21.     </style>
  22. </head>
  23. <body>
  24.     <form method="GET" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'])?>">
  25.         <label>Enter your message / password: </label>
  26.         <input type="text" name="password" value="<?php if(isset($_GET['password'])) echo $_GET['password']?>">
  27.         <input type="submit" name="submit"  value="Show Table">
  28.     </form>
  29.     <table border=1>
  30.         <tr>
  31.             <th>Hash Alogorithm</th>
  32.             <th>Lenght</th>
  33.             <th>Output</th>
  34.         </tr>
  35.         <?php
  36.         if(isset($_GET['password'])){
  37.             $data = htmlspecialchars($_GET['password']);
  38.  
  39.             foreach (hash_algos() as $v) {
  40.                 $r = hash($v, $data, false);
  41.                 echo "
  42.                 <tr>
  43.                     <td> $v </td>
  44.                     <td>".strlen($r)."</td>
  45.                     <td> $r </td>
  46.                 </tr>
  47.  
  48.  
  49.                 ";
  50.  
  51.             }
  52.         }
  53.        
  54.         ?>
  55.  
  56.  
  57.     </table>
  58. </body>
  59. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement