ShaFuck

From Esolang
Jump to: navigation, search

ShaFuck is a version of Brainfuck that is intended to be nigh-on impossible to write.

A ShaFuck program may be any sequence of bytes of a length greater than zero which is a multiple of 1024. The SHA-1 sum of every 1024-byte chunk is calculated, and all of the SHA-1 sums are then concatenated. This sequence of SHA-1 sums is interpreted as Brainfuck code, with the caveat that comments are not allowed. Each 1024-byte chunk in the source therefore represents 20 Brainfuck operations.

A ShaFuck interpreter written by Gregor Richards is available at http://codu.org/eso/shafuck/ .

Cryptanalysis

In December 2012, Shinichiro Hamaji has found a vulnerability that the current (0.2) implementation of ShaFuck does not check if the code is a comment when the code is never executed. Taking this advantage he was able to write a straightforward translator from Brainfuck to ShaFuck.