<p>The following picture was given with a hidden message to extract:</p>
<center><img src = "http://i36.photobucket.com/albums/e42/Samksha/hiltonHiding2bitMessage_zpsze7d7x8e.png" /></center>
<p>After extraction, this is what the hidden message was!</p>
<center><img src = "http://i36.photobucket.com/albums/e42/Samksha/Part%203_zpsmdhehkly.png"/></center>

<h3> Algorithm</h3>
<p> The algorithm used for the extraction is similar to the one used for extraction in the first part.</p>

<h3> Code</h3>

<pre>
function pchange(pixval)
{
    var x = (pixval-Math.floor(pixval/4)*4)*64;
    return x;
}

function extract(image)
{
    for(var pixel of image.values())
    {
        pixel.setRed(pchange(pixel.getRed()));
        pixel.setGreen(pchange(pixel.getGreen()));
        pixel.setBlue(pchange(pixel.getBlue()));
    }
    return image;
}

var combinedimage = new SimpleImage("hiltonHiding2bitMessage.png");
hiddenimage = extract(combinedimage);

print(hiddenimage);
</pre>
  </html>

Comments

Popular posts from this blog

Choose Your Social Media Channels Week 5 Quiz