Advertisement
dimipan80

Pretty Text Hasher

Apr 28th, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.68 KB | None | 0 0
  1. <?php
  2. $text = $_GET['text'];
  3. $hashValue = (int)$_GET['hashValue'];
  4. $fontSize = $_GET['fontSize'];
  5. $fontStyle = $_GET['fontStyle'];
  6.  
  7. $result = "style=\"font-size:{$fontSize};";
  8. if ($fontStyle == 'bold') {
  9.     $result .= 'font-weight:bold;">';
  10. } else {
  11.     $result .= "font-style:{$fontStyle};\">";
  12. }
  13.  
  14. function encryptInputText($text, $hashValue) {
  15.     $encrypted = '';
  16.     for ($i = 0; $i < strlen($text); $i++) {
  17.         $asciiValue = ord($text[$i]);
  18.         if (($i % 2) == 0) {
  19.             $encrypted .= chr($asciiValue + $hashValue);
  20.         } else {
  21.             $encrypted .= chr($asciiValue - $hashValue);
  22.         }
  23.     }
  24.  
  25.     return $encrypted;
  26. }
  27.  
  28. $result .= encryptInputText($text, $hashValue);
  29.  
  30. echo "<p {$result}</p>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement