• Announcements

    • MannDude

      Current state of vpsBoard   02/04/2017

      Dear vpsBoard members and guests:

      Over the last year or two vpsBoard activity and traffic has dwindled. I have had a change of career and interests, and as such am no longer an active member of the web hosting industry.

      Due to time constraints and new interests I no longer wish to continue to maintain vpsBoard. The web site will remain only as an archive to preserve and showcase some of the great material, guides, and industry news that has been generated by members, some of which I remain in contact to this very day and now regard as personal friends.

      I want to thank all of our members who helped make vpsBoard the fastest growing industry forum. In it's prime it was an active and ripe source of activity, news, guides and just general off-topic banter and fun.

      I wish all members and guests the very best, whether it be with your business or your personal projects.

      -MannDude
Sign in to follow this  
Followers 0
HN-Matt

Parody of Diffie-Hellman

3 posts in this topic

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! :)

<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>

 

Share this post


Link to post
Share on other sites
5 hours ago, perennate said:

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0

  • Similar Content

    • By poomrokc
      Hello , sorry for the confusing title ,I do not speak english as my first language.(and also sorry if the topic does not fit here)
      Problem background: I just want to create a website as a competitive program grader for my school. Like complie and run source code on the server. So below is my idea and i would like some help/suggestions before i do it,I still don't know if this will work.
      Mysql usage:
      The problem one is that i would use one of the table as my user-submission queue.When user submit a code, I first put it in this table(i suppose it put the new row in the bottom of the table?) .
      Python program usage:
      I would run a 24/7 program on my server that check every 10 second  if the queue table is not empty, just run the grading process(I know how to do it) and then pop it off the queue.Then check again.
       
      PHP usage:
      When a person submit code, i will use php to put it on the queue table,but it may be the same time my python program is popping something off the queue table too. This is where I get confuse whether it will work or not.(Other usage of the php is just things about web interface which I had done before and know what to do)
       
      So,would this idea even work? Will it break my server or something?As a competitive programmer guy I don't know much snd will greatly appreciate any help from u guys. :)
       
      Thank you very much.
    • By drmike
      I am looking for a programmer / scripter already familiar with PHP and WHMCS.
      Project type work, one off  custom scripts.  Freelance work for someone out there, per piece.
      If interested, PM me your CV / resume or in lieu of such tell me about your experience.  Informal is fine, alternative learners encouraged.
    • By drmike
      Evolving situation with the deceased killers in San Bernadino, California.  You remember these two gems that shot up their coworkers and killed a bunch of people at a work holiday party.  Loons hiding behind the veil of Islam, may I say wrongly.
      Well Apple is getting a dose of the DOJ in legal wranglings where the DOJ is trying to force Apple to unencrypt / unlock phone(s) belonging to the deceased.
      Donald Trump got vocal today on Twitter about it, calling for a boycott of Apple.  Hey, I disagree, but boycotting Apple is a good idea based on their manufacturing outsourcing and money laundering alone.
      This now breaking:
      PHONE BELONGING TO DECEASED HAD PASSWORD CHANGED WITHIN 24 HOURS OF IT BEING IN FEDS CONTROL.
      Source: http://www.buzzfeed.com/johnpaczkowski/apple-terrorists-appleid-passcode-changed-in-government-cust
      It's an interesting situation pitting sane and locked devices vs. the insecure backdoored government / corporate free roaming that has been rather common on all handsets to date minus a few privacy hardened limited models.
      What do you think?
      Should Apple be complying with Big Brother?  Is this just an Apple marketing ploy?  Will Apple hacking own device send wrong signal to buyers who go and revolt and jump to competitors?
    • By wlanboy
      This is my second post for php based projects. My first thread is about an IoT plattform for Ardunio clients.
      This post is about creating a simple web interface for a redis key/value store. If you want to install your own redis database you can use this tutorial: 
      I will use following php frameworks to get the rest interface done: Slim, CorSlim, Predis.
      All the server and client code will be available at github: https://github.com/wlanboy/php-redis-rest-service
      a) Server
      We first have to enable CORS support to enable clients of other domains to use our service:
      require ('CorsSlim/CorsSlim.php'); $app->add(new \CorsSlim\CorsSlim()); $corsOptions = array( "origin" => "*", "exposeHeaders" => array("Content-Type", "X-Requested-With", "X-authentication", "X-client"), "allowMethods" => array('GET', 'POST', 'PUT', 'DELETE', 'OPTIONS') ); $cors = new \CorsSlim\CorsSlim($corsOptions); $app->add($cors); After that we have to get a connection to our local redis instance:
      $app->container->singleton('redisclient', function() { $client = new Predis\Client('tcp://127.0.0.1:6379'); return $client; }); And define the routes:
      //Redis routes $app->get('/key/:id', 'getKey'); $app->post('/key', 'addKey'); And implement them with the help of the Predis framework:
      function getKey($id) { $app = \Slim\Slim::getInstance(); $client = $app->redisclient; try { $value = $client->get($id); $temp = (object) [ $id => $value ]; echo json_encode($temp); } catch(PDOException $e) { echo '{"error":{"text":'. $e->getMessage() .'}}'; } } Done :-)
      b) Client
      I use a simple Ajax JS script for the client. The most simple way to create the GET and POST requests.
      We first defien a data object which is able to create JSON output:
      function KeyValue(key, value) { var kv = {"key":key, "value":value}; kv.toJsonString = function () { return JSON.stringify(kv); }; return kv; }; And a simple send method that reads form data, sends it to the rest service and prints the response:
      function sendMessage() { var key = document.getElementById("postkey").value; var value = document.getElementById("postvalue").value; if (value == "") { jQuery.ajax({ type: "GET", url: "https://rest-api/key/"+key, contentType: "application/json; charset=utf-8", dataType:"json", success: function (data, status, jqXHR) { output = document.getElementById("output"); output.innerHTML = JSON.stringify(data); document.getElementById("postkey").focus(); }, error: function (jqXHR, status) { output = document.getElementById("output"); output.innerHTML = status; document.getElementById("postkey").focus(); } }); } } Using GetElementByID + value to get the input.
      Creating a jQuery ajax request and add the key to the url to get the variable stored in redis.
      Same with the POST request to store the value of a variable in redis:
      else{ var contact = KeyValue(key,value); jQuery.ajax({ type: "POST", url: "https://rest-api/key", contentType: "application/json; charset=utf-8", data: contact.toJsonString(), dataType:"json", success: function (data, status, jqXHR) { output = document.getElementById("output"); output.innerHTML = JSON.stringify(data); document.getElementById("postkey").focus(); }, error: function (jqXHR, status) { output = document.getElementById("output"); output.innerHTML = status; output.innerHTML += "<br/>"; output.innerHTML += jqXHR.responseJSON; document.getElementById("postkey").focus(); } }); } This time with a data line to get the JSON data of the contact element.
      Same JSON.stringify to get the string representation of the json object.
      Done.
      Simple server & client example to use a redis database without any binary client. Simple HTTP requests to use the redis service.
      I will add additional methods to the rest service to add the other redis commands too.
    • By mainline.realty
      Hello,
       
      I am new here and I am hoping to get some answers and continue to use this forum for all my VPS issues; I have notices an odd behavior through my site over time and I think it's about time I took care of it; I have a VPS through WHM cPanel. Medium size package with 2 CPU Cores and 4GB RAM. About 300 Posts (WordPress Platform); I am using an Ok theme that is optimized actually and my score through gtmetrix is about 98% - 92% for yslow.
       
      Here is my issue:
      When I log in to my personal twitter and retweet my website tweets (Let's say about 10 of them) my VPS overloads immediately to 80% or more while it is under 1% any other times. Checking the logs through cPanel I noticed 1 (one) PHP file with "a lot" of queries and that is a sharrre.php - The only thing I can think of is maybe it is not optimized? The theme builder guy is a "no go" for this specific issue. I am attaching the code of that specific file so maybe you guys can help. I would REALLY appreciate it.
      Sarah.
      <?php header('content-type: application/json'); //Sharrre by Julien Hany $json = array('url'=>'','count'=>0); $json['url'] = $_GET['url']; $url = isset(urlencode($_GET['url'])) ? $_GET['url'] ? ''; $type = isset(urlencode($_GET['type'])) ? $_GET['type'] ? ''; $ori_url = isset($_GET['url']) ? $_GET['url'] ? ''; if(filter_var($ori_url, FILTER_VALIDATE_URL)){ if($type == 'googlePlus'){ //source http://www.helmutgranda.com/2011/11/01/get-a-url-google-count-via-php/ $contents = parse('https://plusone.google.com/u/0/_/+1/fastbutton?url=' . $url . '&count=true'); preg_match( '/window\.__SSR = {c: ([\d]+)/', $contents, $matches ); if(isset($matches[0])){ $json['count'] = (int)str_replace('window.__SSR = {c: ', '', $matches[0]); } } else if($type == 'stumbleupon'){ $content = parse("http://www.stumbleupon.com/services/1.01/badge.getinfo?url=$url"); $result = json_decode($content); if (isset($result->result->views)) { $json['count'] = $result->result->views; } } } echo str_replace('\\/','/',json_encode($json)); function parse($encUrl){ $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => 'sharrre', // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 5, // timeout on connect CURLOPT_TIMEOUT => 10, // timeout on response CURLOPT_MAXREDIRS => 3, // stop after 10 redirects CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_SSL_VERIFYPEER => false, ); $ch = curl_init(); $options[CURLOPT_URL] = $encUrl; curl_setopt_array($ch, $options); $content = curl_exec($ch); $err = curl_errno($ch); $errmsg = curl_error($ch); curl_close($ch); if ($errmsg != '' || $err != '') { /*print_r($errmsg); print_r($errmsg);*/ } return $content; }