{"id":216,"date":"2026-03-29T00:18:06","date_gmt":"2026-03-29T00:18:06","guid":{"rendered":"https:\/\/madelinekrajewski.knight.domains\/capstone\/?page_id=216"},"modified":"2026-04-04T22:46:13","modified_gmt":"2026-04-04T22:46:13","slug":"week-9-post","status":"publish","type":"page","link":"https:\/\/madelinekrajewski.knight.domains\/capstone\/blog\/week-9-post\/","title":{"rendered":"Week 9: Algorithm 1 Won&#8217;t Die"},"content":{"rendered":"<h5 class=\"wp-block-heading has-text-align-center\" id=\"madeline-krajewski\">Madeline Krajewski<\/h5>\n\n\n<div class=\"has-text-align-center wp-block-post-date\"><time datetime=\"2026-03-29T00:18:06+00:00\">March 29, 2026<\/time><\/div>\n\n\n<p>This week, I embraced the excruciating truth that Algorithm 1 <em>still isn&#8217;t done.<\/em> This week, I set my sights on finishing it. I stand before you today with the tragic truth: it still isn&#8217;t done. It is, however, getting pretty close! I encoded the width and height, the decoder (and its ability to decode images of different sizes), and a few other bits and bobs. I also revisited <em>Visual Cryptography and Threshold Schemes\u201d by Doug Stinson<\/em> to develop Algorithm 2.<\/p>\n\n\n\n<p>It&#8230; didn&#8217;t really help. I have many questions on how to proceed with it, and my approach is unfortunately not correct. I think I will refrain from explaining my interpretation here, because I am quite certain it is incorrect.<\/p>\n\n\n\n<p>Now, the progress I&#8217;ve made on Algorithm 1:<\/p>\n\n\n\n<p>I moved the encoding of the First Pixel (the number of encoded bits) into its own function in order to make my main function easier to read. This is a small change, but it definitely enhanced my quality of life.<\/p>\n\n\n\n<p>I encoded three pieces of information into the Second Pixel&#8217;s least significant bits: whether or not the number of encoded bits is an eight; whether or not the secret image is the same size of the host image; and finally, whether or not the secret image is 1\/2 the size or smaller than the host image.<\/p>\n\n\n\n<p>Why, you may ask? Well, the first pixel holds the number of bits (from the secret image) which get encoded. There are three binary digits available to use, and that translates to a range of 0-7. I want to allow the user to encode zero <em>and <\/em>eight so they can see what occurs. I think experimentation is an incredible way to learn, and I want to provide that to the user if I can. As such, I need a fourth bit to differentiate between 0 (000 in binary) and eight (1000 in binary). If the eight-&#8220;flag&#8221; is 1, that means we have an eight. It <em>cannot <\/em>be a one if the number of bits exceeds eight.<\/p>\n\n\n\n<p>If the secret image is the same size as the host, hooray! We don&#8217;t need to bother encoding or decoding the secret image&#8217;s width and height. Finally, if the secret image is 1\/2 the size of the host <em>or smaller<\/em> (via the total number of pixels), we can actually encode more information by spreading it out over the host&#8217;s pixels.<\/p>\n\n\n\n<p>The Third and Fourth Pixels will hold an offset (the third pixel holds the x value, and the fourth holds the y value). This offset is used when the secret image&#8217;s size is small enough where we do not have to use the first twelve pixels for encoding image information <em>as well as<\/em> the most significant bits of the secret image. I have not, however, encoded this yet; it will basically reuse the same code as the First Pixel.<\/p>\n\n\n\n<p>The next four pixels have the width of the secret image, and the following four pixels have the height. This allows twelve bits for the width (since each pixel has an R, G, and B value), and twelve for the height. This allotment allows secret images with a width and\/or height of 4,000 pixels in length.<\/p>\n\n\n\n<p>Here is the summary:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"229\" src=\"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-content\/uploads\/2026\/04\/image-1-1024x229.png\" alt=\"\" class=\"wp-image-574\" srcset=\"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-content\/uploads\/2026\/04\/image-1-1024x229.png 1024w, https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-content\/uploads\/2026\/04\/image-1-300x67.png 300w, https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-content\/uploads\/2026\/04\/image-1-768x172.png 768w, https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-content\/uploads\/2026\/04\/image-1.png 1052w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I also wrote the decoder for all of these (as well as the offset decoder, though I cannot verify it works).<\/p>\n\n\n\n<p>I still need to figure the smaller image size encoding and decoding. I know how to do this, but I just did not get to it this week. I cannot wait for it to be done, because then the only things I have to do for it is add hashing (which I don&#8217;t think I&#8217;m required to do), and threading (which I will probably tackle at the same time as the other algorithm, since both will need it in the final versions of my programs).<\/p>\n\n\n\n<p>I am so ready for Algorithm 1 to be over.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/madelinekrajewski.knight.domains\/capstone\/blog\/week-7-post\/\">Previous: Week 7 &amp; 8<\/a><\/div>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<div class=\"wp-block-buttons is-content-justification-right is-layout-flex wp-container-core-buttons-is-layout-d445cf74 wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/madelinekrajewski.knight.domains\/capstone\/blog\/week-10-post\/\">Next: Week 10<\/a><\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Madeline Krajewski This week, I embraced the excruciating truth that Algorithm 1 still isn&#8217;t done. This week, I set my sights on finishing it. I stand before you today with the tragic truth: it still isn&#8217;t done. It is, however, getting pretty close! I encoded the width and height, the decoder (and its ability to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":88,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-216","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/pages\/216","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/comments?post=216"}],"version-history":[{"count":19,"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/pages\/216\/revisions"}],"predecessor-version":[{"id":578,"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/pages\/216\/revisions\/578"}],"up":[{"embeddable":true,"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/pages\/88"}],"wp:attachment":[{"href":"https:\/\/madelinekrajewski.knight.domains\/capstone\/wp-json\/wp\/v2\/media?parent=216"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}