<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>binary &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/binary/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Sat, 04 Apr 2026 08:49:21 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>binary &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Code Palindromes]]></title>
		<link>https://shkspr.mobi/blog/2021/04/code-palindromes/</link>
					<comments>https://shkspr.mobi/blog/2021/04/code-palindromes/#respond</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Sun, 04 Apr 2021 11:26:13 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[binary]]></category>
		<category><![CDATA[programming]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=38545</guid>

					<description><![CDATA[An idle thought on a long weekend. Is it possible to create an executable binary which is a palindrome?  It&#039;s trivial to create a palindromic program in, say, Python:  print(&#34;hello&#34;) # )&#34;olleh&#34;(tnirp   Save that as test.py and then run cat test.py &#124; rev &#124; python3 and it&#039;ll work. But that&#039;s boring!  You could do the same by reversing the bits, rather than the characters:  01110000 01110010…]]></description>
										<content:encoded><![CDATA[<p>An idle thought on a long weekend. Is it possible to create an executable binary which is a palindrome?</p>

<p>It's trivial to create a palindromic program in, say, Python:</p>

<pre><code class="language-python">print("hello") # )"olleh"(tnirp
</code></pre>

<p>Save that as <code>test.py</code> and then run <code>cat test.py | rev | python3</code> and it'll work. But that's boring!</p>

<p>You could do the same by reversing the bits, rather than the characters:</p>

<pre><code class="language-_">01110000 01110010 01101001 01101110 
01110100 00101000 00100010 01101000 
01100101 01101100 01101100 01101111 
00100010 00101001 00100000 00100011 
00000100 10010100 01000100 11110110 
00110110 00110110 10100110 00010110 
01000100 00010100 00101110 01110110 
10010110 01001110 00001110
</code></pre>

<p>That requires a bit more bit-bashing to run properly.  And, if I'm honest, I think padding stuff with reversed comments is cheating.</p>

<p>Is it possible to make an executable assembly program which can be read forwards and back?</p>

<blockquote class="social-embed" id="social-embed-1376838503489806337" lang="en" itemscope="" itemtype="https://schema.org/SocialMediaPosting"><header class="social-embed-header" itemprop="author" itemscope="" itemtype="https://schema.org/Person"><a href="https://twitter.com/regularfry" class="social-embed-user" itemprop="url"><img class="social-embed-avatar social-embed-avatar-circle" src="data:image/webp;base64,UklGRpQBAABXRUJQVlA4IIgBAACQCQCdASowADAAPrVInUqnJCKhrjgMyOAWiWMAtRwEAbzco/XKIFl+OTDnh2qF3M9i1/ke69OohrUqswE7xeUncIUeM3P9pxpKOLfNvtxPPffABWwAAP7sOo/NI4mgtRrUIl34EeB87vA0vE/B2u+Zm2D65DKoR1Sjom6kvdxH9jnU6s+cox7CMvbw0yhXJSfHLuuqYIZpt7RKiDPHbD9LgrdnpKNPxJ8zCXykuQI7W6cEWVL0bZ2NALgImyqtcEh9crTOQghzIYyMBNk97g/kLnas2rzuwdMeqNSyaGDeNmPfBvxeMGZ2rijVbKWsDqUxoYIpR7UJ9ASS4TpuQ9DrZg2kZVaamioAKNf+7J6gkcLCZ7eS02BrT1QIOSdc71NHgquGt8ayJH1MS377+Mn0jD149tL4zsfz5uAFzKrxzSgEBI93p9UZGkKDmUlc9yLc89YQPgzFdi7fYBKde1Wzo7gGSDxJQ+VVi8ox3CvBYXpUdxFk5i7tR8CCkTC77WjTMJaa6AAAAA==" alt="" itemprop="image"><div class="social-embed-user-names"><p class="social-embed-user-names-name" itemprop="name">Alex @regularfry@mastodon.social Young</p>@regularfry</div></a><img class="social-embed-logo" alt="" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCmFyaWEtbGFiZWw9IlR3aXR0ZXIiIHJvbGU9ImltZyIKdmlld0JveD0iMCAwIDUxMiA1MTIiPjxwYXRoCmQ9Im0wIDBINTEyVjUxMkgwIgpmaWxsPSIjZmZmIi8+PHBhdGggZmlsbD0iIzFkOWJmMCIgZD0ibTQ1OCAxNDBxLTIzIDEwLTQ1IDEyIDI1LTE1IDM0LTQzLTI0IDE0LTUwIDE5YTc5IDc5IDAgMDAtMTM1IDcycS0xMDEtNy0xNjMtODNhODAgODAgMCAwMDI0IDEwNnEtMTcgMC0zNi0xMHMtMyA2MiA2NCA3OXEtMTkgNS0zNiAxczE1IDUzIDc0IDU1cS01MCA0MC0xMTcgMzNhMjI0IDIyNCAwIDAwMzQ2LTIwMHEyMy0xNiA0MC00MSIvPjwvc3ZnPg=="></header><section class="social-embed-text" itemprop="articleBody"><small class="social-embed-reply"><a href="https://twitter.com/edent/status/1376817404936916994">Replying to @edent</a></small><a href="https://twitter.com/edent">@edent</a> Related question: are there any paper tape programs which are valid when taped end-to-end as a mobius loop?</section><hr class="social-embed-hr"><footer class="social-embed-footer"><a href="https://web.archive.org/web/20210330100742/https://twitter.com/regularfry/status/1376838503489806337"><time datetime="2021-03-30T10:07:34.000Z" itemprop="datePublished">10:07 - Tue 30 March 2021</time></a></footer></blockquote>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=38545&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2021/04/code-palindromes/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
