TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Radiation-hardened quine

231 pointsby epsylonover 11 years ago

17 comments

danslimmonover 11 years ago
I was curious how well this quine would withstand having more than one character removed, so I performed a test. I did 1000 iterations removing 2 characters each time, then 1000 more removing 3 characters each time, and so on.<p>Here are the results up to 23 removals: <a href="http://i.imgur.com/PwWN7Z7.png" rel="nofollow">http:&#x2F;&#x2F;i.imgur.com&#x2F;PwWN7Z7.png</a>
评论 #7280470 未加载
评论 #7281567 未加载
p4bl0over 11 years ago
Nice!<p>This reminds me of a work I did as an undergrad which landed in a paper called &quot;Can a Program Reverse-Engineer Itself?&quot;. The idea is to take any program&#x2F;function and make it a quine so you can retrieve its original code even if it has been obfuscated. You can find the paper here: <a href="http://pablo.rauzy.name/research.html#imacc11" rel="nofollow">http:&#x2F;&#x2F;pablo.rauzy.name&#x2F;research.html#imacc11</a>.
Cthulhu_over 11 years ago
I can&#x27;t read this code at all, but, does this code basically contain the same code twice, so if something from the first half is removed the second half saves it?
评论 #7277401 未加载
评论 #7294902 未加载
评论 #7277398 未加载
dllthomasover 11 years ago
Fascinating exercise. &quot;Deleting one character&quot; seems a phenomenally unlikely outcome of radiation, though.
评论 #7277697 未加载
评论 #7277492 未加载
评论 #7278602 未加载
评论 #7277808 未加载
meyover 11 years ago
Wouldn&#x27;t radiation flip a bit, rather than remove a character?
zefhousover 11 years ago
Here&#x27;s the google translate link to his blog post about it.<p>My favorite part: &quot;Ruby I terrible.&quot;<p><a href="http://translate.google.com/translate?sl=auto&amp;tl=en&amp;js=n&amp;prev=_t&amp;hl=en&amp;ie=UTF-8&amp;u=http%3A%2F%2Fd.hatena.ne.jp%2Fku-ma-me%2F20140219" rel="nofollow">http:&#x2F;&#x2F;translate.google.com&#x2F;translate?sl=auto&amp;tl=en&amp;js=n&amp;pre...</a>
评论 #7280097 未加载
评论 #7277605 未加载
hyborg787over 11 years ago
Exercise for the reader, make a quine that still works even if any one character is mutated (by 1 bit or 8?), rather than deleted.
评论 #7277428 未加载
throwaway_yy2Diover 11 years ago
Hard mode: flip bits in the interpreter&#x27;s process memory as it&#x27;s running.
评论 #7277414 未加载
评论 #7278092 未加载
评论 #7277814 未加载
评论 #7278416 未加载
michaelmiorover 11 years ago
Depends on how you define &quot;works.&quot; The program continues to output the original source code after the deletion, and ceases to be a quine. Still a very cool trick though :)
评论 #7278371 未加载
zackmorrisover 11 years ago
Interesting! Does anyone know of a language or operating system that uses Reed–Solomon error correction on every file?<p><a href="https://en.wikipedia.org/wiki/Reed–Solomon_error_correction" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Reed–Solomon_error_correction</a><p>Or to top that, imagine a computer where the entire memory space, perhaps shared with persistent flash memory, was encoded in this manner, so that even the filesystem was protected against bit flips.<p>When I was doing Mac repair a few years back, the majority of the PowerMac G5s that came through the doors died premature deaths for two reasons: the ram was in a bad spot which caused the board to bend and crack on insertion, and the ram was non-ECC so it was notoriously difficult to isolate a bad ram chip. It was the most unreliable Mac I ever diagnosed, by perhaps an order of magnitude.<p>Contrast that with the Mac Pro, which used ECC and was so much more reliable that I don&#x27;t remember seeing a single Mac Pro fail in the 3 years I was there.<p>Imagine how stable a Reed–Solomon computer would be..
评论 #7278691 未加载
评论 #7278308 未加载
评论 #7280150 未加载
评论 #7281756 未加载
NAFV_Pover 11 years ago
<p><pre><code> $ git clone the_quine $ cd the_quine $ ruby the_quine The program &#x27;ruby&#x27; can be found in the following packages: * ruby1.8 * ruby1.9.1 # shit I don&#x27;t have ruby $ sudo apt-get install ruby1.9.1 # 200 bytes&#x2F;s, terrible # ... what&#x27;s going on? Ah finally. $ touch output $ ruby rbquine.rb &gt; output $ diff rbquine.rb output # nowt</code></pre>
tompover 11 years ago
This would be much easier to understand if GitHub had proper ruby syntax highlighting. Just yesterday I was testing this, it appears they use very simplistic algorithm for parsing Ruby string interpolation - probably just regexes, which cannot handle nesting.<p><a href="https://gist.github.com/tomprimozic/9113077" rel="nofollow">https:&#x2F;&#x2F;gist.github.com&#x2F;tomprimozic&#x2F;9113077</a>
评论 #7278055 未加载
yincrashover 11 years ago
same author wrote a 50 language quine: <a href="https://github.com/mame/quine-relay" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mame&#x2F;quine-relay</a>
th0ma5over 11 years ago
I recommend reading specs for low power digital radio protocols like WSPR for ideas around basic error correction. Just something I did recently and was fun.
NAFV_Pover 11 years ago
I looked at his git profile, I recognised the name: Yusuke Endoh - multiple IOCCC winner. Here is one of my favourites:<p><a href="http://www.ioccc.org/2012/endoh1/hint.html" rel="nofollow">http:&#x2F;&#x2F;www.ioccc.org&#x2F;2012&#x2F;endoh1&#x2F;hint.html</a>
jherikoover 11 years ago
i wonder how far this can be taken... e.g. flipping or setting a random string of bits that would be physically contiguous in hardware as if a real neutron came smashing into the memory... if doing it during run can be achieved etc.<p>how about a real native app with instructions? i&#x27;d never expect something as high level and wooly as ruby in systems that will be exposed to radiation. that&#x27;s just asking for failure imo... how robust is the interpreter for instance?
评论 #7277502 未加载
heydenberkover 11 years ago
If you had asked me I might&#x27;ve said this was impossible.