amuck-landowner

Parody of Diffie-Hellman

HN-Matt

New Member
Verified Provider
If you're new to PHP, here is a simple parody of Diffie-Hellman expressivity using for loops to get you started. Conversion to a bash script will not be very difficult and you'll be selling 'strong' encryption in no time! :)

Code:
<span style='font-family: monospace; font-size: 13px;'>
<?php
// parody of Diffie-Hellman
for ($lines=1; $lines<=86; $lines++) {
   for ($dhm=1; $dhm<=150; $dhm++) {
      $dhparam = rand(1, 50);
      if ($dhparam == "1") {
         $dhparam = "+";
      } else {
         $dhparam = ".";
      }
      if ($lines != "86") {
         if ($dhm <= "150") {
            print $dhparam;
         }
      }
      if ($lines == "86") {
         if ($dhm < "145") {
            print $dhparam;
         } else {
            print "++*++*";
            break;
         }
      }
   }
   print "<br />";
}
?>
</span>
 
Last edited by a moderator:

HN-Matt

New Member
Verified Provider
What is "Diffie-Hellman expressivity"?

I guess it could be a lot of things, but I was referring to the output of 'openssl dhparam -out dhparams.pem wxyz' in particular.
 
Last edited by a moderator:
Top
amuck-landowner