| Bytes | Lang | Time | Link |
|---|---|---|---|
| 004 | Rust | 250507T125706Z | Deadbeef |
| nan | 250509T085022Z | jlab | |
| 010 | Python 3 | 210310T185619Z | Makonede |
| nan | 210218T183532Z | Makonede | |
| 007 | Python 3 | 211109T235220Z | Larry Ba |
| 015 | Vyxal | 210717T093053Z | emanresu |
| 004 | Vim | 210706T164647Z | Aaroneou |
| 003 | Vim | 210706T164519Z | Aaroneou |
| 032 | Pyth | 210312T151459Z | Citty |
| 007 | Javascript | 210311T151616Z | Etheryte |
| 003 | Python 3 | 210222T150647Z | qwatry |
| 006 | Python 3 | 210217T230030Z | Makonede |
| 005 | Rust | 210207T135713Z | Deadbeef |
| 004 | nasm | 210206T225008Z | EasyasPi |
| 013 | Python 3 | 210204T214814Z | qwatry |
| 105 | JavaScript THREE.js 105 Must include canvas element ~48 bytes | 210203T181313Z | HitchHac |
| 009 | Desmos | 210203T170457Z | HitchHac |
| 002 | R | 201111T203528Z | Robin Ry |
| 006 | Julia | 201108T201532Z | binaryca |
| 005 | Julia | 201106T225813Z | binaryca |
| 002 | Desmos | 201109T220443Z | Aiden Ch |
| nan | 201107T080104Z | pxeger | |
| 018 | Ruby | 201107T004713Z | binaryca |
| 017 | Ruby | 201106T235919Z | binaryca |
| 017 | Ruby | 201106T231336Z | binaryca |
| 003 | Haskell | 201106T224233Z | binaryca |
| 004 | Jelly | 201106T014037Z | caird co |
| 004 | Jelly | 201106T020127Z | caird co |
| 005 | Python 2 | 201106T012611Z | xnor |
Rust, 4 bytes, cracked by Themoonisacheese
"'"'
Expecting this to be an easy crack, probably. No compiler flags allowed.
Disallowed characters:
"'/
Themoonisacheese's crack using a shebang, revised disallowed characters:
#"'/
Plain TeX
\def\bye
The document must compile without error (you can't simply comment the whole line: Fatal error occurred, no output PDF file produced!).
Banned character
\
Intended solution
^^\def\byeusing that the sequence^^will read the next char as an ASCII number.
Python 3, 10 bytes, cracked by The Fifth Marshal
?"""?'''?
Banned characters
Alphanumeric, whitespace, and non-ASCII.
The intended solution makes use of an interesting quirk in the Python parser.
Here's a hint if you want one:
The hint is that there is no hint. (This isn't a joke. This is actually the hint.)
Intended Answer
Hexdump:
00000000: 2300 0a3f 2222 223f 2727 273f #..?"""?'''?
For some reason,
the Python parser seems to ignore characters following null characters.
So,
it ignores the newline after the
#␀, therefore treating the?"""?'''?as part of the comment.
Fun fact: This was actually posted on the original Find an Illegal String challenge, but when I found a way to get around it, I decided to post it here.
Python 3, 7 bytes, cracked by @EasyasPi
Still not the intended answer, so I'm just revealing it. Scroll to the bottom to see it.
raise
Banned characters
TAB "'(),.=[\]_{|}
Non-ASCII characters are all banned as well. Try it online or validate it online!
Some cracks that work without the banned chars
'''
raise'''
"""
raise"""
raise SystemExit
raiseTABSystemExit # originally posted by EasyasPi here, he found yet another loophole
raise\
SystemExit
raiser=3 # originally posted by EasyasPi on v1 of this challenge
Intended Answer
#coding:U7 quit+ACgAKQ- raise
This works because
the magic comment at the top sets the file encoding to UTF-7
and
in UTF-7, characters can be encoded by first converting them to their UTF-16 binary representations, and concatenating them if there are multiple characters to be encoded. Here, we want to call
quit, so we need to convert(). This becomes0000 0000 0010 1000 0000 0000 0010 1001. Next, we regroup them into groups of 6, to get000000 000010 100000 000000 001010 01, and pad the last group with trailing zeros (if necessary). In this case, we get000000 000010 100000 000000 001010 010000. Finally, we convert these to the corresponding Base64 characters (table here), gettingACgAKQ, prepend a+, and append a-.
So,
()in UTF-7 is+ACgAKQ-. We use this fact to bypass the banned()and callquitanyways, by replacing()with+ACgAKQ-. This exits the program before it can throw any errors.
Python 3, 7 bytes
"""'''$
(Note no starting or trailing newline.)
Disallowed characters:
#
Vyxal, 15 bytes, Cracked by lyxal
«Wi«»Wi»`Wi`Wi
No bans, do what you want. Note that silently erroring at compile-time (Nothing appears in the 'output' box) counts as an error - even the empty program outputs 0...
My intended solution was prepending a [ to just make sure the code isn't run.
Vim, 4 bytes, cracked by tail spark rabbit ear
<Esc><Esc>ZQ
This one is a bit more difficult than my other Vim one.
Intended Solution:
i<C-o>:<C-r><Esc><Esc>ZQ
Vim, 3 bytes, cracked by tail spark rabbit ear
<Esc>ZQ
A Vim program doesn't really "error out" per se, but ZQ will exit the current file without saving, so it can't be executed in a valid program, thereby making it "illegal".
This is a bit of an easier one, if you know Vim.
Intended Solution:
i<C-v><Esc>ZQ
Javascript, 7 bytes, cracked by Makonede
...void
Javascript, 8 bytes, cracked by Makonede
Note one trailing space
...void
Banned characters:
- all comments:
//,/**/ - all strings:
"",``,'' - curlies:
{} - brackets:
[] - asterisk:
* - the letter
w
Clarifications: My cop answer works in a browser environment, but there are probably solutions in Node too.
Python 3, 3 bytes, Cracked by user
I can't believe I missed that obvious loophole! I am adding a slightly revised version of my code that should avoid this.
New Answer, 4 bytes, Cracked by Unrelated String
1=2
Note: There is a space at the beginning of the code.
Banned characters: All non-ascii characters, quotes, and #.
"'#
Old Answer, 3 bytes, Cracked by user:
1=2
Banned characters: All non-ascii characters, quotes, and #.
"'#
My intended solution for both posts:
foo : 1=2
Python 3, 6 bytes, cracked by EasyasPi
@EasyasPi's crack does work (and I'm dumb for letting it work), but I'm not revealing the original solution yet; I've posted a v2 hopefully preventing any loopholes.
raise
Banned characters
"'(),.:[\]_{|}
Non-ASCII characters are all banned as well. Try it online or validate it online!
Some cracks that work without the banned chars
'''
raise'''
"""
raise"""
raise SystemExit
raise\
SystemExit
Rust, 5 Bytes (Safe)
:! =1
Banned Characters:
|!/"'
A nightly compiler is used, you may pass any flags to rustc if you like.
A crack by @EasyasPi does work (and is brilliant), but I think because the question says "you must write a program that contains ...", if your code is not designed to run, it isn't a program :)
The intended solution
The idea is to create a local variable that has the never type, call some functions on the integer 1 such that it becomes the never type.
However, with ! as a banned character, we can't simply put the #![feature(never_type)] attribute on the top of the program. We must use an unstable rustc flag that allows us to inject crate-level attributes. The command to compile would be:
cargo rustc -- -Z crate-attr='feature(never_type, core_panic)'
Because closures (|| something) and the use of the ! type outside are restricted, we must operate on the integer literal with provided functions. This is where the core_panic feature comes in and gives us a nice way to transform a &str into !. We know the start and the end, we can just put them together:
use std::io::stdout;
use core::panicking::panic_str;
use std::borrow::Borrow;
fn main() {
let a:! =1i8.checked_neg().as_ref().map(ToString::to_string).as_ref().map(Borrow::borrow).map(panic_str).unwrap();
}
nasm, 4 bytes, safe
[al]
Banned characters:
;"`'%#
Solution:
sectionis, as far as I know, the only thing in NASM which accepts an arbitrary string without quotes.Try it online!section [al] section .text global _start _start: mov eax, 60 syscall
Stop giving me these assembly ones for free. 😔
Python 3, 13 bytes, Cracked by EasyasPi
int(А,В,С)
Banned Characters: All ascii characters except 2()~+ and newlines. '"#= are banned.
!"#$%&'*,-./013456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}
The solution makes use of an odd python 3 feature.
JavaScript (THREE.js 105) (Must include canvas element) ~48 bytes
const scene = new THREE.Scene();
scene.add(cube);
Note empty lines Try it!
Banned Characters: All quote characters
/
Desmos, 9 bytes,
sort(3,2
Banned characters: New Lines
I'm hoping that most people are not familiar with Desmos here, so people wouldn't know what to try.
Note:
An expression in Desmos would be considered an error if it shows a "danger sign" next to the expression, like this:
R, 2 bytes, cracked by Dominic van Essen
'"
Banned characters (newlines are banned):
'"`#\qel
This bans the obvious cracks I can think of, but I wouldn't be surprised if you come up with a crack very different to what I intend.
Dominic van Essen cracked a first version of this challenge, and then a second; then Giuseppe cracked a third version. I have added qel and newlines to the list of banned character to sidestep their cracks.
The solution I had in mind was
assign(intToUtf8(c(37,39,34,37)), c); 1 %'"% 2
The assign call creates a new binary operator, %'"%; it is equivalent to "%'"%" <- c. In R, you can create new operators of the form %x% where x is any string: %}%, %$@% and %µ£$% are all valid operator names. Here, the new operator is equal to the concatenation function c and so the output is the vector 1 2.
Dominic's crack doesn't define the operator; he simply buried it in a try call, which is also valid R code.
The trick used here means that any future attempt at an almost illegal string will probably have to ban the % character.
Julia, 6 bytes
?""":
There is a zero width space before the :
Disallowed characters: #
Desmos, 2 bytes, cracked by PkmnQ
Substring:
\
(Note the newline in the beginning)
Banned characters: All alphanumeric characters
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
I'm hoping that most people are not familiar with Desmos here, so people wouldn't know what to try.
Note:
An expression in Desmos would be considered an error if it shows a "danger sign" next to the expression, like this:
Zsh
#include <cstdlib>
#include <iostream>
int main() {
srand(time(NULL));
hello();
return rand() % 2;
}
/*
main
a=0
\
print "$((1/$a))"
*/
void hello() std::cout << "Hello, World!" << std::endl;
- Allowed characters: all printable ASCII except
blxy<'`$(lowercase B, L, X, and Y, single-quote, grave, dollar sign) - Please note all the leading and trailing whitespace.
Probably not too hard but you may learn a lot about the many - shall we say "quirks" - of zsh.
Ruby, 18 bytes
=end
#{/"""'}
=end
Disallowed characters: N,%,/
my final variation, hopefully the next solution is the intended one.
Ruby, 17 bytes
=end
#{"""'}
=end
Disallowed characters: N,%
This time I made it a bit harder.
Haskell, 3 bytes
#"
(begins with a newline)
Disallowed charachters: -
Jelly, 4 bytes, cracked by HyperNeutrino
«{
You may not use newlines. Any other character/byte is fair game
My intended solution was any of the banned characters here aside from ”. Each of these characters cause the parsing of the link to break, meaning everything before them gets ignored:
Jelly, 4 bytes, cracked by Unrelated String
«{
I'm giving Jelly another go, but with slightly more restrictions. You may not use quƁƘȤ(ƈɦƙɱɲƥʠʂȥ (the unimplemented commands in Jelly), ” or newlines, as these make it far too trivial to crack (thanks to HyperNeutrino for showing that)
Neither HyperNeutrino's crack in the comments, nor Unrelated String's crack was my intended solution. Putting a Œ (or any of ÐÆØœæ) with nothing after it at the end causes the same behaviour as any of quƁƘȤ(ƈɦƙɱɲƥʠʂȥ, as they always expect to have a character after them. Without any character, they cause a break in the program chain, meaning that everything before them is ignored:
Python 2, 5 bytes (cracked by tsh)
bin()
Banned: all characters except alphanumeric characters
abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
So, you're allowed the above characters and nothing else (in addition to bin() itself).
(This idea isn't mine, I remember it from an earlier challenge, but I don't remember who deserves credit for it.)
