{"id":6909,"date":"2025-04-12T00:01:30","date_gmt":"2025-04-12T07:01:30","guid":{"rendered":"https:\/\/c-for-dummies.com\/blog\/?p=6909"},"modified":"2025-04-19T08:56:05","modified_gmt":"2025-04-19T15:56:05","slug":"silicon-valley-encryption-part-i","status":"publish","type":"post","link":"https:\/\/c-for-dummies.com\/blog\/?p=6909","title":{"rendered":"Silicon Valley Encryption, Part I"},"content":{"rendered":"<p>I&#8217;m a fan of the HBO Series, <em>Silicon Valley<\/em>. From creator Mike Judge, it excellently showcases the antics of the nerds who populate California&#8217;s Silicon Valley and the companies they work for. It&#8217;s a brilliant series that I highly recommend to my techy friends. Plus, it&#8217;s chock full of digitally delightful easter eggs.<br \/>\n<!--more--><br \/>\nThe show centers around a group of programmers working in an incubator. One of them, Richard, stumbles upon a compression algorithm that is magnitudes greater than anything else. This &#8220;Pied Piper&#8221; algorithm is the catalyst that runs the show and motivates the many adventures and missteps that take place, lampooning a lot of Silicon Valley culture.<\/p>\n<p>At one point, Richard quits the company he founded, leaving the other programmers to try to figure out his algorithm. An easter egg is found in a screenshot the code, shown in Figure 1. Fellow programmers are trying to decipher what Richard has done. One of them, Dinesh, points to an undocumented number in the code and says, &#8220;What is this number?&#8221;<\/p>\n<div id=\"attachment_6910\" style=\"width: 310px\" class=\"wp-caption aligncenter\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-6910\" src=\"https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2025\/03\/0419-Silicon-Valley-Code-300x277.png\" alt=\"\" width=\"300\" height=\"277\" class=\"size-medium wp-image-6910\" srcset=\"https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2025\/03\/0419-Silicon-Valley-Code-300x277.png 300w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2025\/03\/0419-Silicon-Valley-Code-768x710.png 768w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2025\/03\/0419-Silicon-Valley-Code-324x300.png 324w, https:\/\/c-for-dummies.com\/blog\/wp-content\/uploads\/2025\/03\/0419-Silicon-Valley-Code.png 811w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><p id=\"caption-attachment-6910\" class=\"wp-caption-text\">Figure 1. Dinesh (Kamail Nanjiani) is frustrated by Richard&#8217;s poorly-documented and obfuscated Pied Piper code. (<em>Silicon Valley<\/em>, HBO)<\/p><\/div>\n<p>The number shown in the code is an easter egg. The code is C, all visible in the image. When compiled, it outputs the string <code>DREAM_ON_ASSHOLES<\/code>, which is appropriate for one programmer to say to others who try to decode what was done. Here is the code:<\/p>\n<h3><a href=\"https:\/\/github.com\/dangookin\/C-For-Dummies-Blog\/blob\/master\/2025_04_12-Lesson.c\" rel=\"noopener\" target=\"_blank\">2025_04_12-Lesson.c<\/a><\/h3>\n<pre class=\"screen\">\r\n#include &lt;stdio.h&gt;\r\n#include &lt;stdlib.h&gt;\r\n\r\ntypedef unsigned long u64;\r\n\r\n<span class=\"comments\">\/* Start here *\/<\/span>\r\ntypedef void enc_cfg_t;\r\ntypedef int enc_cfg2_t;\r\ntypedef __int128_t dcf_t;\r\n\r\nenc_cfg_t _ctx_iface(dcf_t s, enc_cfg2_t i){\r\n    int c = (((s &amp; ((dcf_t)0x1FULL &lt;&lt; i * 5)) &gt;&gt; i * 5 ) + 65);\r\n    printf(\"%c\",c); }\r\n    enc_cfg2_t main() {\r\n    for (int i=0; i&lt;17; i++){\r\n        _ctx_iface(0x79481E6BBCC01223 + ((dcf_t)0x1222DC &lt;&lt; 64), i);\r\n    }\r\n}\r\n<span class=\"comments\">\/* End here *\/<\/span><\/pre>\n<p>The remainder of the code from the screenshot isn&#8217;t pertinent to the program. It might be another easter egg, but I concentrated on the code shown above.<\/p>\n<p>Overall, the code is deliberately cryptic. It uses <em>typedef<\/em> statements to obscure the standard data types <em>void<\/em> and <em>int<\/em>. The indentation and formatting isn&#8217;t consistent, which makes it even more opaque.<\/p>\n<p>Buried in there is the <em>main()<\/em> function. It loops, calling the <em>_ctx_iface()<\/em> function 17 times, once for each digit in the value 0x79481E6BBCC01223. This is the number Dinesh references in Figure 1.<\/p>\n<p>What the code does is to decrypt the value 0x79481E6BBCC01223, which results in single characters output, forming the string <code>DREAM_ON_ASSHOLES<\/code>, which is funny if you watch the show.<\/p>\n<p>It&#8217;s odd to me that the <em>main()<\/em> function fails to return a value, which doesn&#8217;t trigger any warnings, at least when built by using the <em>clang<\/em> compiler.<\/p>\n<p>In <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=6916\">next week&#8217;s Lesson<\/a>, I un-obfuscate the code and comment upon it further.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How did Richard do it? What is this number? <a href=\"https:\/\/c-for-dummies.com\/blog\/?p=6909\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-6909","post","type-post","status-publish","format-standard","hentry","category-main"],"_links":{"self":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6909","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6909"}],"version-history":[{"count":7,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6909\/revisions"}],"predecessor-version":[{"id":6958,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/6909\/revisions\/6958"}],"wp:attachment":[{"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6909"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6909"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/c-for-dummies.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6909"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}