Brainfuck is an esoteric programming language created in 1993 by Swiss student Urban Müller. Designed to be extremely minimalistic, the language consists of only eight simple commands, a data pointer , and an instruction pointer .
33-455: Brainfuck is an example of a so-called Turing tarpit : it can be used to write any program, but it is not practical to do so because it provides so little abstraction that the programs get very long or complicated. While Brainfuck is fully Turing-complete , it is not intended for practical use but to challenge and amuse programmers . Brainfuck requires one to break down commands into small and simple instructions. The language takes its name from
66-482: A function — mem frob () —which has a similar purpose to ROT13, although it is intended for use with arbitrary binary data. The function operates by combining each byte with the binary pattern 00101010 ( 42 ) using the exclusive or (XOR) operation. This effects a simple XOR cipher . Like ROT13, XOR (and therefore memfrob() ) is self-reciprocal, and provides a similar, virtually absent, level of security. The ROT13 and ROT47 are fairly easy to implement using
99-428: A Google research project used a slightly modified 7-command version of Brainfuck as the basis of an artificial digital environment. In this environment, they found that replicators arose naturally and competed with each other for domination of the environment. Turing tarpit A Turing tarpit (or Turing tar-pit ) is any programming language or computer interface that allows for flexibility in function but
132-520: A letter with the 13th letter after it in the Latin alphabet . ROT13 is a special case of the Caesar cipher which was developed in ancient Rome. Because there are 26 letters (2×13) in the basic Latin alphabet , ROT13 is its own inverse ; that is, to undo ROT13, the same algorithm is applied, so the same action can be used for encoding and decoding. The algorithm provides virtually no cryptographic security, and
165-496: A simple addition program as follows: The following program prints "Hello World!" and a newline to the screen: For readability, this code has been spread across many lines, and blanks and comments have been added. Brainfuck ignores all characters except the eight commands +-<>[],. so no special syntax for comments is needed (as long as the comments do not contain the command characters). The code could just as well have been written as: This program enciphers its input with
198-417: A telephone number such as +1-415-839-6885 is not obvious at first sight from the scrambled result Z'\c`d\gbh\eggd . On the other hand, because ROT47 introduces numbers and symbols into the mix without discrimination, it is more immediately obvious that the text has been encoded. Example: enciphers to The GNU C library , a set of standard routines available for use in computer programming , contains
231-459: Is a practice similar to ROT13 that applies to numeric digits (0 to 9). ROT13 and ROT5 can be used together in the same message, sometimes called ROT18 (18 = 13 + 5) or ROT13.5. ROT47 is a derivative of ROT13 which, in addition to scrambling the basic letters, treats numbers and common symbols. Instead of using the sequence A–Z as the alphabet, ROT47 uses a larger set of characters from the common character encoding known as ASCII . Specifically,
264-574: Is difficult to learn and use because it offers little or no support for common tasks. The phrase was coined in 1982 by Alan Perlis in the Epigrams on Programming : 54. Beware of the Turing tar-pit in which everything is possible but nothing of interest is easy. In any Turing complete language, it is possible to write any computer program, so in a very rigorous sense nearly all programming languages are equally capable. However, having that theoretical ability
297-455: Is either to perform ROT13 encoding on, or to reverse its input. The newsgroup alt.folklore.urban coined a word— furrfu —that was the ROT13 encoding of the frequently encoded utterance " sheesh ". " Furrfu " evolved in mid-1992 as a response to postings repeating urban myths on alt.folklore.urban, after some posters complained that "Sheesh!" as a response to newcomers was being overused. ROT5
330-514: Is not the same as usefulness in practice. Turing tarpits are characterized by having a simple abstract machine that requires the user to deal with many details in the solution of a problem. At the extreme opposite are interfaces that can perform very complex tasks with little human intervention but become obsolete if requirements change slightly. Some esoteric programming languages , such as Brainfuck or Malbolge , are specifically referred to as "Turing tarpits" because they deliberately implement
363-450: Is often cited as a canonical example of weak encryption . ROT13 has been used in online forums as a means of hiding spoilers , punchlines , puzzle solutions, and offensive materials from the casual glance. ROT13 has inspired a variety of letter and word games online, and is frequently mentioned in newsgroup conversations. Applying ROT13 to a piece of text merely requires examining its alphabetic characters and replacing each one by
SECTION 10
#1733085883288396-431: Is recognizable from some letter/word patterns. The words "n", "V" (capitalized only), and "gur" (ROT13 for "a", "I", and "the"), and words ending in "yl" ("ly") are examples. ROT13 is not intended to be used where secrecy is of any concern—the use of a constant shift means that the encryption effectively has no key , and decryption requires no more knowledge than the fact that ROT13 is in use. Even without this knowledge,
429-449: Is theoretically capable of computing any computable function or simulating any other computational model if given access to an unlimited amount of memory and time. A variety of Brainfuck programs have been written. Although Brainfuck programs, especially complicated ones, are difficult to write, it is quite trivial to write an interpreter for Brainfuck in a more typical language such as C due to its simplicity. Brainfuck interpreters written in
462-487: Is typically supported as a built-in feature to news reading software. Email addresses are also sometimes encoded with ROT13 to hide them from less sophisticated spam bots . It is also used to circumvent email screening and spam filtering. By obscuring an email's content, the screening algorithm is unable to identify the email as, for instance, a security risk, and allows it into the recipient's in-box. In encrypted, normal, English-language text of any significant size, ROT13
495-518: The English language are abjurer and nowhere , and Chechen and purpura . Other examples of words like these are shown in the table. The pair gnat and tang is an example of words that are both ROT13 reciprocals and reversals. The 1989 International Obfuscated C Code Contest (IOCCC) included an entry by Brian Westley. Westley's computer program can be encoded in ROT13 or reversed and still compiles correctly. Its operation, when executed,
528-473: The ROT13 cipher. To do this, it must map characters A-M ( ASCII 65–77) to N-Z (78–90), and vice versa. Also it must map a-m (97–109) to n-z (110–122) and vice versa. It must map all other characters to themselves; it reads characters one at a time and outputs their enciphered equivalents until it reads an EOF (here assumed to be represented as either -1 or "no change"), at which point the program terminates. In 2024,
561-423: The 7-bit printable characters, excluding space, from decimal 33 ' ! ' through 126 ' ~ ', 94 in total, taken in the order of the numerical values of their ASCII codes, are rotated by 47 positions, without special consideration of case. For example, the character A is mapped to p , while a is mapped to 2 . The use of a larger alphabet produces a more thorough obfuscation than that of ROT13; for example,
594-462: The Brainfuck language itself also exist. As a first, simple example, the following code snippet will add the current cell's value to the next cell: Each time the loop is executed, the current cell is decremented, the data pointer moves to the right, that next cell is incremented, and the data pointer moves left again. This sequence is repeated until the starting cell is 0. This can be incorporated into
627-496: The English alphabet and 26 = 2 × 13, the ROT13 function is its own inverse : In other words, two successive applications of ROT13 restore the original text (in mathematics , this is sometimes called an involution ; in cryptography, a reciprocal cipher ). The transformation can be done using a lookup table , such as the following: For example, in the following joke, the punchline has been obscured by ROT13: Transforming
660-499: The ROT13 toy example—provided with the Adobe eBook software development kit —for a serious encryption scheme. Windows XP uses ROT13 on some of its registry keys. ROT13 is also used in the Unix fortune program to conceal potentially offensive dicta . ROT13 provides an opportunity for letter games. Some words will, when transformed with ROT13, produce another word. Examples of 7-letter pairs in
693-674: The Unix terminal application tr ; to encrypt the string "Pack My Box With Five Dozen Liquor Jugs" in ROT13: and the string "The Quick Brown Fox Jumps Over The Lazy Dog" for ROT47: In Emacs , one can ROT13 the buffer or a selection with the commands M-x toggle-rot13-mode , M-x rot13-other-window , or M-x rot13-region . In the Vim text editor , one can ROT13 a buffer with the command ggg?G . The module codecs provides 'rot13' text transform. Without importing any libraries, it can be done in
SECTION 20
#1733085883288726-415: The algorithm is easily broken through frequency analysis . Because of its utter unsuitability for real secrecy, ROT13 has become a catchphrase to refer to any conspicuously weak encryption scheme; a critic might claim that "56-bit DES is little better than ROT13 these days". Also, in a play on real terms like "double DES", the terms "double ROT13", "ROT26", or "2ROT13" crop up with humorous intent (due to
759-493: The entire text via ROT13 form, the answer to the joke is revealed: A second application of ROT13 would restore the original. ROT13 is a special case of the encryption algorithm known as a Caesar cipher , used by Julius Caesar in the 1st century BC. Johann Ernst Elias Bessler , an 18th-century clockmaker and constructor of perpetual motion machines, pointed out that ROT13 encodes his surname as Orffyre . He used its latinised form, Orffyreus , as his pseudonym. ROT13
792-664: The fact that, since applying ROT13 to an already ROT13-encrypted text restores the original plaintext , ROT26 is equivalent to no encryption at all), including a spoof academic paper entitled "On the 2ROT13 Encryption Algorithm". By extension, triple-ROT13 (used in joking analogy with 3DES) is equivalent to regular ROT13. In December 1999, it was found that Netscape Communicator used ROT13 as part of an insecure scheme to store email passwords. In 2001, Russian programmer Dimitry Sklyarov demonstrated that an eBook vendor, New Paradigm Research Group (NPRG), used ROT13 to encrypt their documents; it has been speculated that NPRG may have mistaken
825-443: The first command, and each command it points to is executed, after which it normally moves forward to the next command. The program terminates when the instruction pointer moves past the last command. The brainfuck language uses a simple machine model consisting of the program and instruction pointer, as well as a one-dimensional array of at least 30,000 byte cells initialized to zero; a movable data pointer (initialized to point to
858-446: The goal of implementing the smallest possible compiler , inspired by the 1024- byte compiler for the FALSE programming language . Müller's original compiler was implemented in assembly and compiled to a binary with a size of 296 bytes. He uploaded the first Brainfuck compiler to Aminet in 1993. The program came with a "Readme" file , which briefly described the language, and challenged
891-478: The leftmost byte of the array); and two streams of bytes for input and output (most often connected to a keyboard and a monitor respectively, and using the ASCII character encoding). The eight language commands each consist of a single character: [ and ] match as parentheses usually do: each [ matches exactly one ] and vice versa, the [ comes first, and there can be no unmatched [ or ] between
924-520: The letter 13 places further along in the alphabet , wrapping back to the beginning if necessary. A becomes N , B becomes O , and so on up to M , which becomes Z , then the sequence continues at the beginning of the alphabet: N becomes A , O becomes B , and so on to Z , which becomes M . Only those letters which occur in the English alphabet are affected; numbers, symbols, punctuation, whitespace, and all other characters are left unchanged. Because there are 26 letters in
957-439: The minimum functionality necessary to be classified as Turing complete languages. Using such languages is a form of mathematical recreation : programmers can work out how to achieve basic programming constructs in an extremely difficult but mathematically Turing-equivalent language. ROT13 ROT13 ( Rotate13 , " rotate by 13 places ", sometimes hyphenated ROT-13 ) is a simple letter substitution cipher that replaces
990-431: The reader "Who can program anything useful with it? :)". Müller also included an interpreter and some examples. A second version of the compiler used only 240 bytes. The language consists of eight commands . A brainfuck program is a sequence of these commands, possibly interspersed with other characters (which are ignored). The commands are executed sequentially, with some exceptions: an instruction pointer begins at
1023-428: The slang term brainfuck , which refers to things so complicated or unusual that they exceed the limits of one's understanding, as it was not meant or made for designing actual software but to challenge the boundaries of computer programming . Because the language's name contains profanity , many substitutes are used, such as brainfsck, branflakes, brainoof, brainfrick, BrainF, and BF. Müller designed Brainfuck with
Brainfuck - Misplaced Pages Continue
1056-450: The two. Brainfuck programs are usually difficult to comprehend. This is partly because any mildly complex task requires a long sequence of commands and partly because the program's text gives no direct indications of the program's state . These, as well as Brainfuck's inefficiency and its limited input/output capabilities, are some of the reasons it is not used for serious programming. Nonetheless, like any Turing-complete language, Brainfuck
1089-415: Was in use in the net.jokes newsgroup by the early 1980s. It is used to hide potentially offensive jokes, or to obscure an answer to a puzzle or other spoiler . A shift of thirteen was chosen over other values, such as three as in the original Caesar cipher , because thirteen is the value for which encoding and decoding are equivalent, thereby allowing the convenience of a single command for both. ROT13
#287712