"Hello, World!" (Cops' thread)

16

3

This is the cops' thread. The robbers' thread is here.

Your challenge is to write a program or function that, with a certain input, prints the exact string Hello, World! and a newline. Capitalization, spacing and punctuation must be exact.

Input may be taken via standard input, a file, or command-line/function arguments. Output may be given via return value, writing to a file, or standard output.

Your program must print Hello, World! for at least one input. When your program is given the wrong input (i.e. the input that does not make it print Hello, World!), it can do whatever you like - crash, print random nonsense, call Chuck Norris, etc.

You may not use a hashing algorithm or any similar methods of obscuring the required input.

Submissions are preferred to be runnable & crackable on TIO. Submissions not runnable or crackable on TIO are allowed, but please include instructions to download / run them.

After one week, this challenge will be closed to future cop submissions. The winner is the shortest code that is uncracked after a week of posting it ("it" being the code, not this challenge). The winner will be accepted after two weeks.

After a week has passed since posting, please mark your answer as safe and show the input (in a > ! spoiler quote). If a robber cracks your submission (before the week ends), please mark it as cracked and show the halting input (in a > ! spoiler quote).

Looking for uncracked submissions?

fetch("https://api.stackexchange.com/2.2/questions/137742/answers?order=desc&sort=activity&site=codegolf&filter=!.Fjs-H6J36vlFcdkRGfButLhYEngU&key=kAc8QIHB*IqJDUFcjEF1KA((&pagesize=100").then(x=>x.json()).then(data=>{var res = data.items.filter(i=>!i.body_markdown.toLowerCase().includes("cracked")).map(x=>{const matched = /^ ?##? ?(?:(?:(?:\[|<a href ?= ?".*?">)([^\]]+)(?:\]|<\/a>)(?:[\(\[][a-z0-9/:\.]+[\]\)])?)|([^, ]+)).*[^\d](\d+) ?\[?(?:(?:byte|block|codel)s?)(?:\](?:\(.+\))?)? ?(?:\(?(?!no[nt][ -]competing)\)?)?/gim.exec(x.body_markdown);if(!matched){return;}return {link: x.link, lang: matched[1] || matched[2], owner: x.owner}}).filter(Boolean).forEach(ans=>{var tr = document.createElement("tr");var add = (lang, link)=>{var td = document.createElement("td");var a = document.createElement("a");a.innerHTML = lang;a.href = link;td.appendChild(a);tr.appendChild(td);};add(ans.lang, ans.link);add(ans.owner.display_name, ans.owner.link);document.querySelector("tbody").appendChild(tr);});});
<html><body><h1>Uncracked Submissions</h1><table><thead><tr><th>Language</th><th>Author</th></tr></thead><tbody></tbody></table></body></html>

MD XF

Posted 2017-08-05T17:21:06.367

Reputation: 11 605

Very similar not a dupe though. – Post Rock Garf Hunter – 2017-08-05T17:22:36.557

13

As I said in the sandbox, I feel that this is a duplicate of the halting question since any answer there could be posted here instead but with code for and infinite loop replaced with code to print hello world. I won't vote yet because I'd hammer, but I'm pretty convinced this is a dupe.

– FryAmTheEggman – 2017-08-05T18:07:52.497

5Obviously sha3 falls into that category, but otherwise where do you draw the line? I mean the mod 1e3 is also a hash function, and I'd even go so far and argue that many of the submissions are going to be hash functions, as this challenge is basically asking for such. – flawr – 2017-08-05T21:52:12.730

Is the trailing newline entirely necessary? I just added a byte to the end of my submission, but still I see a few other people have missed it off too. – Jonathan Allan – 2017-08-05T23:24:43.970

What exactly counts as a hashing algorithm? Would summing the codepoints of a string be a hashing algorithm? How about treating a string as a base-256 number? – Conor O'Brien – 2017-08-06T01:22:51.180

@FryAmTheEggman Related, but not dupe. In case of no comparing with "Hello world" its different. For example when doing some input manipulations. – Евгений Новиков – 2017-08-06T13:00:46.743

1Based on the answers I've seen in the past day, nothing has appeared that convinces me this isn't a duplicate. I'm going to close the cop challenge for now, and if the community disagrees it can be reopened, and if the community agrees they can close the robber thread too. – FryAmTheEggman – 2017-08-06T13:30:26.563

@FryAmTheEggman now i am developing non dupe crackme. To avoid dupe submissions you can edit rules – Евгений Новиков – 2017-08-06T13:44:37.040

1@Dopapp this has already been discussed, here (some comments deleted) and in chat. Answers cannot be copy-pasted, nor very easily ported, from that challenge to this one, so they are not duplicates. – MD XF – 2017-08-06T17:49:27.297

Can cop's program interact with crack? i.e. robber's program do calculations, based on debug output of cop's program, and then send suitable for this case input – Евгений Новиков – 2017-08-07T06:42:21.770

What's a "similar method of obscuring the required input"? I'm doing some calculations on numerical input in one of my submissions, but nothing that's specifically hard to reverse (like a hash function is), so I guess this is ok? – Felix Palmen – 2017-08-07T13:31:39.980

@FelixPalmen I believe that mostly is directed at one-way functions (hash functions), RSA stuff (giant primes) or the like – Stephen – 2017-08-07T14:14:44.133

I assume that, just wanted to be sure my C64 submission isn't against the rules :) – Felix Palmen – 2017-08-07T15:12:33.630

I think I should post this meta post to gather more discussion as to what kind of inputs are valid; because as it stands, some cracks are really stretching the definition of a input a lot.

– Voile – 2017-08-07T18:18:58.893

Answers

3

Python 3, 191 186 bytes (SAFE!)

Same as my previous answer, but without the noob eval statement, so that somebody actually has to solve the problem I created.

import sys
from numpy import *
e=enumerate
c='Hello, World!'
print(''.join([c[int(sum([c*cos(n*i)for i,c in e(fromiter(sys.argv[1:],float))])+.01)]for n in[2*i+ord(n)for i,n in e(c)]]))

now execute it with the correct parameters, such as python3 hw.py 1 2 3


Edit: previous version was missing a comma in "Hello, World!", and also I realized that it had an unnecesary ennumerate, which is now gone.


Edit 2: Just for fun, here is an almost identical Pyth version (47 bytes) of the same code:

KEJ"Hello, World!"jkm@J.Rs.e*b.t*dk1K0.e+*2kCbJ

Input is taken from stdin and is in the form of a list of arguments, such as [1,2,3]

I see no point in posting a separate answer because if you crack the Pthyon3 version, then you also crack the Pyth version, even without knowing Pyth.


Answer:

python3 hw.py 10.72800138 13.23008796 19.30176276 16.13233012 18.10716041 0.98306644 8.18257475 19.20292132 10.99316856 -2.15745591 6.01351144 5.45443094 10.41260889

Explanation of code:

''.join() creates the hello world string out of an array of characters from the string "Hello, World!". The puzzle is solved when those indicies are [0,1,2,3,4,5,6,7,8,9,10,11,12]. Each index is calculated from an input and the constants given on the command line. The inputs are a hard coded series: [2*i+ord(c) for i,c in enumerate('Hello, World!')]. The funtion that relates the input, the constants, and the output (indicies) is this: sum([c*cos(x*i) for i,c in enumerate(CONSTANTS)]). This is a classic modelling problem, where you are trying to fit data to your model.

Arriving at the solution, in python:

from scipy import optimize
x = [2*i+ord(c) for i,c in eumerate('Hello, World!')]
y = [0,1,2,3,4,5,6,7,8,9,10,11,12].
# make your function: 13 terms means we can achieve 13 exact outputs
def f(x,a,b,c,d,e,f,g,h,i,j,k,l,m):
    return sum([c*cos(x*i) for i,c in enumerate([a,b,c,d,e,f,g,h,i,j,k,l,m])])
# curve fit
ans,_ = optimize.curve_fit(f,x,y)
# check answer
[round(f(a,*ans),0) for a in x] # should be 0-12

rexroni

Posted 2017-08-05T17:21:06.367

Reputation: 386

2Just in case you didn't know, literal_eval() in the ast module can be used to safely evaluate expressions, so that the print( code injection problem wouldn't work. It's probably not relevant here, but I just thought I'd mention it. – Esolanging Fruit – 2017-08-07T04:36:06.813

2are you sure this can print Hello, World!? Haven't cracked yet, but it looks like it's missing a comma (only 12 iterations in join loop) – Uriel – 2017-08-07T13:07:11.100

Oh, you are right, it is missing a comma. I will correct it now. – rexroni – 2017-08-07T13:45:26.677

@Challenger5 thank you, I did not know that. – rexroni – 2017-08-07T13:53:13.237

12

TeX - 38 bytes Cracked(ish)

This is worth a shot, because I can't imagine anyone on a site about writing short pieces of code would know TeX:

\read16to\x\message{Hello, World!}\bye

To run it, you should get a hold of some form of TeX that allows interactive mode. Save this to a file, and run TeX (or pdfTeX, XeTeX, etc.) on it.

Edit: I'm currently considering this semi-cracked. The intended solution uses input from stdin, but TeXnically input from the way the program is invoked is valid. I'll be adding more devious TeX answers if someone gets the intended method.

Here's the intended solution:

^C Ia - The first key is control-c, which causes an error. Then, you press I (capital i) to input a command. Then you type a (or anything else to be typeset). Normally, the message that was printed to stdout would be followed by a space and then a ')'. When you typeset something, it causes the font information to be output after the message. That means that a newline is thrown in, and the ')' gets moved later.

That may be underhanded, but should still be within the rules of the game.

A Gold Man

Posted 2017-08-05T17:21:06.367

Reputation: 280

Welcome to PPCG. Good first answer – Евгений Новиков – 2017-08-07T07:21:55.530

Wouldn't it suffice to use tex \ Hello, world!\bye (23 bytes)? – Werner – 2017-08-07T10:09:57.570

@Werner that would allow user input? – A Gold Man – 2017-08-07T10:41:59.093

Is this actually meant to be cracked? :o – Felix Palmen – 2017-08-07T14:44:41.457

@agoldman: What follows tex is input. Whether that qualifies according to the question I don't know. – Werner – 2017-08-07T16:34:22.970

You can crack this if you're an evil, devious TeXacker. There will be an answer eventually. – A Gold Man – 2017-08-07T22:10:43.677

Is using the commandline arguments of tex for "wrapping" this ok? – Felix Palmen – 2017-08-08T09:23:10.450

@FelixPalmen eh, I would consider it only fair to post an answer that interacts with the program written. You can't completely take advantage of the ability to give arbitrary input. But if you're thinking of what I'm thinking, yes that's a fair answer, but not the intended one. – A Gold Man – 2017-08-08T12:00:33.280

Well, I won't give details here of course. Calling this from my own commandline snippet of TeX commands, I can make it print "Hello, World!" with the newline. But I can't so far with only input from stdin. So you say there's a way to do it? Of course I don't want to submit a "lame" crack ;) – Felix Palmen – 2017-08-08T13:40:21.903

Ok, I suggest this crack. Please judge for yourself if it is somewhat similar to what you had in mind. If fiddling with the environment is considered "wrong", I'll retract it.

– Felix Palmen – 2017-08-08T17:23:18.883

3texnically oh, gosh. – MD XF – 2017-08-08T22:02:21.740

Sorry, let me fix that </joke> – A Gold Man – 2017-08-09T08:26:55.307

@FelixPalmen I put up the intended input. I still think your crack is at least as fair as what I intended. – A Gold Man – 2017-08-15T07:55:19.490

7

><>, 538 bytes, Cracked by rexroni

v
\">/v>v\v</>"
/!?lp%*2di%*2di
a
v   "        "       "
   "l"      "o"  /  "e"
v   "        "     " "
      "   /       "l"/
v    "!"           "
 //   " " "      \
v     \"d"o"   " "    "
      " " "   "o"r"  "!"
v"   "H"       " "    "
"l"   ""
""    "r" "         "
    \  " "l"       "d"  "
v   "     "      "  "  "H"
   "e"         /","     "
v " " "     "  " "
 "e" "W"  /"d""l"
v " " "     "  "      "
   "H"               "!"
v   "                 "
                        v
>>"Hello world?"       >o<
                        ^

Try it online, or you may want to use the fish playground.

The first three lines read in a string from STDIN and use its charcodes mod 26 as coordinates to put the characters ">/v>v\v</>" into the maze below. The intended solution is a 20-character string made of the letters A–Z only (although you're allowed to use anything you want, of course).

Solution:

The intended input is OCEANICWHITETIPSHARK (it's a fish!). The path through the maze looks like:

v
\">/v>v\v</>"
/!?lp%*2di%*2di
a                |  |
v   "        "   |  |"
| v"l"______"o"__/  "e"
v | "        "     " "
| |   "   /       "l"/
v |  "!"           "|
|//   " " "    v_\  |
v|    \"d"o"   " "  | "
||    " " "   "o"r" |"!"
v"   "H"       " "  | "
"l"___""_______ _/__/_____
""    "r" "    | |  "
|>__\  " "l"   | | "d"  "
v   "     "    | "  "  "H"
|  "e"v________/"," |   "
v " " "     "  " "  |
|"e"|"W"  /"d""l"|  |
v " " "     "  " |  | "
<  "H">__________ __\"!"__
v   "            |  | "
    >____________ __ ___v
>>"Hello world?" |  |  >o<
                 |  |   ^

Not a tree

Posted 2017-08-05T17:21:06.367

Reputation: 3 106

Cracked! Took me forever. – rexroni – 2017-08-09T15:53:35.233

3Hey, I suspected the answer might be a word, but I didn't make any attempt to unscramble it. I stand even more impressed. – rexroni – 2017-08-10T04:26:40.593

6

Octave, 59 bytes, Cracked

This works in Octave 4.2.0. I can't guarantee compatibility with all versions.

i=input('');printf('%c',i*~all(isequal(i,'Hello, World!')))

Note: This doesn't print any trailing spaces or newlines. This is what it looks like:

enter image description here

It basically says: "Print the input string, unless the input is 'Hello, World!', in which case it should print nothing (or the null-character).

Stewie Griffin

Posted 2017-08-05T17:21:06.367

Reputation: 43 471

I'm not sure if %c means string or char...maybe you're hiding something? Also the *~ makes me a bit suspicious... – Erik the Outgolfer – 2017-08-05T19:56:10.943

I'm not sure, but cracked?

– ბიმო – 2017-08-05T20:17:18.880

@BruceForte prints a null byte at the end of output, I'm not sure that's valid... link

– MD XF – 2017-08-05T20:18:13.310

@MDXF Me neither, but it might be. Did you read the motivation in my answer? – ბიმო – 2017-08-05T20:21:07.793

@BruceForte I did, but I'm still not sure... guess we'll just have to wait for OP. – MD XF – 2017-08-05T20:28:30.147

My submission doesn't have \00 in there, but it's somewhat similar so I consider it cracked. I won't reveal the "trick" just yet, in case I want to use something related in another answer. – Stewie Griffin – 2017-08-05T20:58:58.170

@StewieGriffin But it's not the \n is it? Because that caused quite some confusion in the robber thread. – ბიმო – 2017-08-05T21:24:21.037

1

I'm pretty sure the intended solution is this kind of thing.

– Jonathan Allan – 2017-08-06T00:15:31.917

@JonathanAllan, yes, that's what I was going for =) I suggest you post that as a separate crack, since it doesn't contain any unprintables and is therefore "more correct".

– Stewie Griffin – 2017-08-06T06:43:00.250

1@BruceForte, no. there was no \n. I thought the question text said "optional trailing newline". – Stewie Griffin – 2017-08-06T06:44:41.607

5

CJam, 7 bytes (cracked)

q5/:i:c

Try it online!

Intended input:

65608656376564465644656476558065568656236564765650656446563665569

Erik the Outgolfer

Posted 2017-08-05T17:21:06.367

Reputation: 38 134

Cracked – Jonathan Allan – 2017-08-05T20:49:06.353

@JonathanAllan Darn! That wasn't the intended input though. – Erik the Outgolfer – 2017-08-06T08:37:25.373

5

Explode, 23 bytes, Cracked

@_?&4_-j>5&f^~c>&6\|4>7

More coming, this is just the beginning >:)

Try it online!

Explorer Explanation

There are four explorers in this program. I'm not entirely sure that wait (>) is working correctly.

@_?

Read user input (?), write and extend the tape (@) down (_).

&4_-j>5

For 4 ticks (4), modify the tape (&) downwards (_), jumping by 5 (5), by subtracting (-) 19 (j).

&f^~c>

For 16 ticks (f), modify the tape (&) upwards (^) in a wave (~), alternating no affect, +13, no affect, and -13 (c).

&6\|4>7

For 6 ticks (6), modify the tape (&) in both directions (|), decreasing (\) by 4 (4) each time, and jumping by 7 (7). Decreasing means that it subtracts 4 the first time, 8 the second time, etc.

Stephen

Posted 2017-08-05T17:21:06.367

Reputation: 12 293

3Cracked but feel free to give an explanation of the goings on :) – Jonathan Allan – 2017-08-06T00:50:10.507

@JonathanAllan explanation added, sorry I took so long – Stephen – 2017-08-08T14:31:18.750

5

MATL, 6 bytes. Cracked

tsZp?x

Try it online!

Luis Mendo

Posted 2017-08-05T17:21:06.367

Reputation: 87 464

Cracked, but if this isn't the intended solution, it feels a bit like cheating. – Dennis – 2017-08-06T05:14:19.990

@Dennis The intended solution was ['Hello,' 1 'World!']. Why cheating? :-( The doc/help for D says Most input characters below 32 are replaced by space – Luis Mendo – 2017-08-06T10:01:51.193

I meant cheating on my part, turning an LF newline into a CR+LF newline. – Dennis – 2017-08-06T15:22:51.370

@Dennis Ah, I see. Well, I think it's perfectly valid too – Luis Mendo – 2017-08-06T16:23:17.817

5

JavaScript (ES6), 173 169 163 150 151 148 143 bytes (Cracked)

Let's have something totally different... and totally evil.

const e=eval,p=''.split,c=''.slice,v=[].every,f=s=>(t=c.call(s),typeof s=='string'&&t.length<81&&v.call(p.call(t,`\n`),l=>l.length<3)&&e(t)(t))

Usage: f(something) // returns 'Hello, World!'

Try it online!

Voile

Posted 2017-08-05T17:21:06.367

Reputation: 394

Let us continue this discussion in chat.

– Евгений Новиков – 2017-08-07T09:06:40.010

Cracked – DanTheMan – 2017-08-10T07:15:14.660

Nice! That's a real crack. – Voile – 2017-08-10T07:23:33.017

This was really tough to crack. Good job! – DanTheMan – 2017-08-10T07:49:13.537

It's directly taken from one of the puzzles I've created on elsewhere :) (I'll let people figure out where I posted the original puzzle.) – Voile – 2017-08-10T08:31:51.760

Also, bonus challenge: do this without invoke e at all :) – Voile – 2017-08-10T08:35:05.880

4

C# (.NET Core), 130 152 bytes, CRACKED

+22 bytes, I forgot about trailing newline... Program works the same as before, the newline is added to any output.

a=>a.Distinct().Select((x,y)=>a.Reverse().Skip(y).First()*x%255).Take(a.First()-33).Concat(new int[]{10}).Select(x=>(char)x).ToArray()

Try it online!

Byte count also includes

using System.Linq;

For a start I went for something not too crazy. It can has multiple answers.

The "official" crack:

. !$0%>5&8'#?)S*TuE[MRX`+9

Grzegorz Puławski

Posted 2017-08-05T17:21:06.367

Reputation: 781

2Cracked – Kamil Drakari – 2017-08-06T00:09:09.383

4

tcc, 89 bytes, cracked by Dennis

#!/usr/bin/tcc -run
#include <stdio.h>

int main()
{
    puts("\n");
}
#include "/dev/stdin"

This is particularly evil due to tcc's dynamic resolution. Lots of functions are predeclared and trying to overwrite them simply doesn't work.

Joshua

Posted 2017-08-05T17:21:06.367

Reputation: 3 043

Could you create a working TIO link for people to play with? (this is no doubt incomplete - maybe it needs compiler flags or something, I have no idea) TBH I don't even know how this is meant to take input...?

– Jonathan Allan – 2017-08-06T01:57:33.990

Tio's tcc is not going to work. It doesn't get that this must be used as tcc -run rather than a separate compile and link phase. – Joshua – 2017-08-06T02:58:06.087

Maybe it's runnable via a shell through there then, bash is available (I know very little regarding either tcc or bash though). Otherwise I think you should give some detailed instructions to get people going (unless my personal lack of knowledge is the issue here - as I said I don't even know how your code gets any input, all I see is a puts and I thought that outputs.) – Jonathan Allan – 2017-08-06T03:08:13.590

Almost have a crack but I'm on mobile and mprotect is being a butt. – MD XF – 2017-08-06T03:23:29.763

cracked – Dennis – 2017-08-06T04:43:03.047

4

Bash, 62 bytes, (cracked by ArchDelacy)

[[ ! "${1////x}" =~ [[:alnum:]] ]]&&[[ $# = 1 ]]&&bash -c "$1"

No alphanumerics or forward slashes. You should have fun with this one.

Try it online!

Sisyphus

Posted 2017-08-05T17:21:06.367

Reputation: 1 521

cracked by ArchDelacy – Dennis – 2017-08-07T07:01:21.750

4

brainfuck, 7 bytes cracked

,+[.,+]

Try it online!

Good luck. (doesn't work with every BF interpreter

Christopher

Posted 2017-08-05T17:21:06.367

Reputation: 3 428

Does your input work with any BF interpreter, including ones with different tape lengths? Does your input work locally, and not just on TIO? – Stephen – 2017-08-08T21:20:27.703

@StepHen any length of type afaik – Christopher – 2017-08-08T21:22:00.690

cracked – rexroni – 2017-08-08T22:00:48.513

1Does your intended solution work on TIO? – totallyhuman – 2017-08-08T22:03:23.647

@totallyhuman thanks, edited the comment so it looks pro. I don't know how to put non-printable input on TIO. I passed input on stdin from a C program with a single printf statement. – rexroni – 2017-08-08T22:06:03.910

@totallyhuman nope. Idk if bug – Christopher – 2017-08-08T22:19:05.903

3

Cubically, 159 bytes (Cracked)

+53$!7@6:2/1+551$?7@6:5+52$!7@66:3/1+552$?7@6:5+3/1+4$!7@6:5/1+3$?7@6:5+1/1+54$!7@6:3/1+552$?7@6:5+1/1+552$?7@6:5+52$!7@6:1/1+551$?7@6:5+1/1+3$!7@6:1/1+1$(@6)7

This will be pretty easy to those who are comfortable with Cubically. Try it online!

MD XF

Posted 2017-08-05T17:21:06.367

Reputation: 11 605

1Is anybody comfortable with Cubically? :P – totallyhuman – 2017-08-05T21:02:37.117

@totallyhuman The language is actually pretty simple once you get used to it, and it's fun to use! – TehPers – 2017-08-06T05:11:50.707

@totallyhuman It looks like there aren't any turning instructions, so this seems like mostly just math with multiples of 9. Very, very convoluted math. – Robert Fraser – 2017-08-06T08:42:46.577

Cracked? I think I got the intended input, but it doesn't quite work, but I'm pretty sure it fails due to an interpreter bug. See my explanation in crack post. If I am right, then you were right that it was actually darn easy : ) – rexroni – 2017-08-10T05:40:42.730

3

6502 machine code (C64), 51 53 bytes (Cracked)

00 C0                     .WORD $C000     ; load address
20 FD AE                  JSR $AEFD
20 EB B7                  JSR $B7EB
8A                        TXA
0A                        ASL A
45 14                     EOR $14
8D 21 C0                  STA $C021
45 15                     EOR $15
85 15                     STA $15
49 E5                     EOR #$E5
85 14                     STA $14
8E 18 D0                  STX $D018
A0 00                     LDY #$00
B1 14                     LDA ($14),Y
20 D2 FF                  JSR $FFD2
C8                        INY
C0 0E                     CPY #$0E
D0 F6                     BNE *-8
60                        RTS
C8 45 4C 4C 4F 2C 20 D7   .BYTE "Hello, W"
4F 52 4C 44 21 0D         .BYTE "orld!", $D

Online demo

Usage: SYS49152,[x],[n], where x is a 16bit unsigned integer and n is an 8bit unsigned integer.

Input is 52768 and 23 (SYS49152,52768,23)

The second parameter is directly written to D018, a control register of the VIC-II graphics chip. Using a suitable reference, you can deduce what to write there for setting lowercase mode without changing other modes and the address of the screen memory: $17, or decimal 23. With that, you can follow the arithmetics in the code, so the first parameter ends up with the correct string address in $14/$15 (little-endian). A more in-depth explanation can be found in the crack.

Screenshot

Invoked with wrong values, a crash is very likely.

For cracking, you might want to run it in a local installation of vice, so here's a BASIC loader to paste into the emulator (RUN it to place the program at $C000):

0fOa=49152to49202:rEb:pOa,b:nE
1dA32,253,174,32,235,183,138,10,69,20,141,33,192,69,21,133,21,73,229,133,20,142
2dA24,208,160,0,177,20,32,210,255,200,192,255,208,246,96,200,69,76,76,79,44,32
3dA215,79,82,76,68,33,13

Update: Added two bytes for the load address to make this an executable C64 PRG file in response to the discussion on meta

Felix Palmen

Posted 2017-08-05T17:21:06.367

Reputation: 3 866

Are you sure you need to call the comma checking function at the beginning? I'm under the impression that b7eb does that check, too. – A Gold Man – 2017-08-10T04:51:04.560

b7eb calls aefd, but only after calling ad8a (parse number as float (!)(wtf)(MS)) and b7f7 (convert that float to 16bit unsigned int) -- so I have to first call aefd myself for consuming the first comma. – Felix Palmen – 2017-08-10T05:14:00.143

Cracked! Sweet sweet vengeance! – A Gold Man – 2017-08-10T16:01:16.190

@AGoldMan finally edited my post. Again, well done! Maybe I can come up with another C64 code that's a bit harder to crack (without being unfair), not sure yet :) – Felix Palmen – 2017-08-11T07:02:18.030

3

JavaScript (ES6), 102 bytes (Cracked)

The previous version has a massive cheese. Let's try this again...

f=s=>{let r='',i=0;while(i<13)r+=!s[i][0]||s[i]=='Hello, World!'[i]||s[i++];return r};Object.freeze(f)

Try it online!

Author solution:

new Proxy({v:Array(13).fill(0)},{get:(o,p)=>['a','','Hello, World!'[p]][o.v[p]++]})

Usage:

var p=new Proxy({v:Array(13).fill(0)},{get:(o,p)=>['a','','Hello, World!'[p]][o.v[p]++]}) console.log(f(p))

Voile

Posted 2017-08-05T17:21:06.367

Reputation: 394

Cracked – Birjolaxew – 2017-08-07T12:10:33.660

2

Python 2, 63 bytes, cracked

Just to get the ball rolling...

#coding:rot13
cevag vachg()==h'Hello, World!'naq'Hello, World!'

Try it online!

totallyhuman

Posted 2017-08-05T17:21:06.367

Reputation: 15 378

1Is it generally accepted for the OP to crack submissions? – MD XF – 2017-08-05T17:33:29.733

1cracked – Post Rock Garf Hunter – 2017-08-05T17:42:25.177

3That's interesting... I hadn't realized any "normal" language supports coding in ROT13 o_o – ETHproductions – 2017-08-05T18:04:17.197

@ETHproductions PHP also has native support for that.

– Arnauld – 2017-08-05T18:23:47.323

13@Arnauld And you're claiming PHP is a normal language? – NoOneIsHere – 2017-08-05T18:35:46.290

1@NoOneIsHere Er... no. My bad. :-P – Arnauld – 2017-08-05T18:53:41.923

2

Pyth, 18 bytes (Cracked)

IqGQ"Hello, World!

This is extremely easy, and anyone that knows Pyth would crack it in the blink of an eye, but still... Note that you must put the String between quotes.

Try it online!

Mr. Xcoder

Posted 2017-08-05T17:21:06.367

Reputation: 39 774

If anyone cracks it, please edit in yourselves. – Mr. Xcoder – 2017-08-05T18:12:04.647

Cracked? – totallyhuman – 2017-08-05T18:18:27.850

1@totallyhuman Yep – Mr. Xcoder – 2017-08-05T18:18:43.880

2

JavaScript (Browser only), 95 bytes (Cracked)

try{a=JSON.parse(prompt());try{a=='[object Object]'}catch(a){alert('Hello, World!')}}catch(a){}

Not too hard. Has multiple solutions.

user72349

Posted 2017-08-05T17:21:06.367

Reputation:

cracked: https://codegolf.stackexchange.com/a/137759/31343

– Maltysen – 2017-08-05T19:04:11.620

@Maltysen. That was fast! :) – None – 2017-08-05T19:12:52.463

2

Jelly, 11 bytes (cracked)

sLƽ$Xṙ5O½Ọ

Try it online!

Intended input:

〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ〡㋄ⶐ✐сᑀ⟙ⶐⶐ〡ސЀᶑ

Erik the Outgolfer

Posted 2017-08-05T17:21:06.367

Reputation: 38 134

Cracked – HyperNeutrino – 2017-08-05T19:32:12.160

@HyperNeutrino Heh that was sneaky, given it lived for over half an hour. ;) – Erik the Outgolfer – 2017-08-05T19:48:44.460

Heh that's cuz I only saw it 10 minutes before seeing it ;P – HyperNeutrino – 2017-08-05T20:08:40.417

2

05AB1E, 20 bytes (Cracked)

Shouldn't be too hard though:

•GG∍Mñ¡÷dÖéZ•2ô¹βƵ6B

Uses the 05AB1E encoding. Try it online!

Adnan

Posted 2017-08-05T17:21:06.367

Reputation: 41 965

1cracked – Jonathan Allan – 2017-08-05T20:24:22.550

2

Jelly,  20  21 bytes (Cracked)

+1 byte - "...and a trailing newline"

œ?“¥ĊɲṢŻ;^»œ?@€⁸ḊFmṪ⁷

Try it online!

There are, in fact, infinite solutions.

Jonathan Allan

Posted 2017-08-05T17:21:06.367

Reputation: 67 804

I think I cracked this. My crack works with the which is for some reason missing from the TIO link, so I hope I didn't confuse myself.

– tehtmi – 2017-08-06T05:51:52.020

Sorry about the TIO mistake! – Jonathan Allan – 2017-08-06T13:10:26.243

2

Ly, 12 bytes (Cracked)

n[>n]<[8+o<]

Try it online!

I don't expect this to last very long, but oh well. It didn't last very long.

LyricLy

Posted 2017-08-05T17:21:06.367

Reputation: 3 313

Cracked – Jonathan Allan – 2017-08-06T01:11:49.767

2

Lua 5.1, 44 bytes (Cracked)

s=...loadstring(#s>4+#s:gsub("%l","")or s)()

Note that Lua 5.1 is a different language than Lua 5.2 or Lua 5.3. "Try it online" doesn't have Lua 5.1. You can check your Lua version by running print(_VERSION). (There should be a solution in any implementation that uses PUC-Rio's Lua 5.1 core.)

As a test harness, you can use something like this:

function test(...)s=...loadstring(#s>4+#s:gsub("%l","")or s)()end

test[[
This is my input!
It can have multiple lines!
]]

Test harness on repl.it

tehtmi

Posted 2017-08-05T17:21:06.367

Reputation: 446

2

Python3, 192 bytes Cracked I guess

from sys import *
from numpy import *
e=enumerate
c='Hello World!'
w=eval(argv[1])
x=[ord(n)+2*i for i,n in e(c)]
print(''.join([c[int(sum([c*cos(n*i)for i,c in e(w)])+.01)]for i,n in e(x)]))

The text it reads is the first program argument: python3 hw.py '[1,2,3]'

Don't be lame and try to put a print("Hello World!") statement as the argument... it prints an error afterwards anyways (at least on the command line), so I don't think that should count. (Edit: somebody did exactly that)

rexroni

Posted 2017-08-05T17:21:06.367

Reputation: 386

4Cracked. Lame crack, but unrestricted eval must be punished =) – Sisyphus – 2017-08-06T06:11:44.897

2

C (GCC on TIO), 84 bytes golfed (Cracked)

#include<stdio.h>
main(x){scanf("%d",&x);printf("%2$s","Hello, World!\n",(void*)x);}

Here's an ungolfed version that works too:

#include <stdio.h>
int main(void)
{
    int x;
    scanf("%d",&x);

    printf("%2$s","Hello, World!\n",(void*)x);
}

MD XF

Posted 2017-08-05T17:21:06.367

Reputation: 11 605

2

CJam, 130 bytes (safe)

q'p/{'s/{{"cjaei"#}%{)},{`}%S*}%']*}%'[*~]Y8#,:Y;0a\{{__a#{\{_T=}{1$E}w\;}{"T(:T; _T=co T)
:T)0e] _T=)Y=T\t _T=(Y=T\t"S/=~}?}/}:E~;

Try it online!

This is split across two lines for clarity; the newline is not included.

This is semi-golfed, which makes it that much harder to understand.

There are an infinite number of solutions here. If anybody wants to try and find one, I wish them good luck...

Solution:

aipeepceeaiaeeeaeeeccsiiiiaesnccccjccccijcjjccejccccjaajaaaijcjeeejaajaijcccccej

Esolanging Fruit

Posted 2017-08-05T17:21:06.367

Reputation: 13 542

How are inputs fed into the function? I tried to feed in some inputs (via arguments and input) but no output whatsoever. – Voile – 2017-08-10T07:47:37.587

@Voile Inputs are read via STDIN. And yes, most inputs won't produce any visible output. – Esolanging Fruit – 2017-08-10T18:04:23.440

2

JavaScript (ES6) 107 Bytes [Thanks Евгений Новиков] (Cracked)

i=r=>{for(e="",n=0;r.length>n;o=r.charCodeAt(++n),e+=String.fromCharCode(((3^o^19)<<1^15^13)<<1));return e}

Call on the i function using a string.

The console.log... is for testing purposes.

Try It Online!

Ephellon Dantzler

Posted 2017-08-05T17:21:06.367

Reputation: 103

Welcome to PPCG! You can save 8 bytes: (1) remove var, (2) () from one arrow-function argument, (3) replace return to eval("") (4) delete ; at the end. 110 bytes solution: https://pastebin.com/qwdm7fT7 Good luck

– Евгений Новиков – 2017-08-07T07:19:46.720

Finally got 50 rep, so: Cracked

– Voile – 2017-08-07T11:09:24.773

2

JavaScript (ES6), 92 bytes (Cracked)

This simple string copy function seems to be really resisting you to copy any strings resembling Hello, World!...

f=s=>{let r='',i=0;while(i<13)r+=s[i]=='Hello, World!'[i]||s[i++];return r};Object.freeze(f)

Try it online!

Voile

Posted 2017-08-05T17:21:06.367

Reputation: 394

2

Röda, 71 bytes (Cracked)

{[[head(_)]..[unpull(1)if[_1>1]]]|[_()|chars|unorderedCount|[_*(_-1)]]}

Try it online!

Usage: push(/* input */) | f() (where f is a variable that holds the function above).

fergusq

Posted 2017-08-05T17:21:06.367

Reputation: 4 867

Cracked – user41805 – 2017-08-07T10:20:00.803

2

JavaScript (ES6), 135 119 bytes, (Cracked)

const t='Hello, World!',g=q=>eval(`(function(p,q${q}){return eval(p),eval(q)})`),f=s=>g('')(s,0)==t&&g('=1')(s,0)!=t&&t

Try it online!

Voile

Posted 2017-08-05T17:21:06.367

Reputation: 394

Cracked – Birjolaxew – 2017-08-07T11:26:53.333

2

Ruby, 88 bytes, Cracked by w0lf

require'prime'
n=gets.to_i
n.prime?&&$><<n.to_s(36)[0,5].capitalize
$><<", #$'"if/30191/

Try it online!

histocrat

Posted 2017-08-05T17:21:06.367

Reputation: 20 600

cracked – Cristian Lupascu – 2017-08-07T13:43:34.237

1

C (gcc), 80 bytes, Cracked

#define O(c)(((char**)v)+c)
#define W(c)*(O(c)-**O(2)+x)
main(x,v){puts(W(42));}

Try it online!

Provide command line arguments for the desired output.

The intended input commandline was:

"Hello, World!" ,

Quick explanation:

The program does some pointer arithmetics on argv[], using the first char of the second argument and the argument count. See the robbers' post for a full explanation. There are other solutions possible, but the one over there is the most simple one.

Important: This won't work when e.g. built for amd64, therefore the compiler switch -m32 on tio.

Felix Palmen

Posted 2017-08-05T17:21:06.367

Reputation: 3 866

Cracked – ArchDelacy – 2017-08-07T22:39:02.313

1

Perl 5, 23 bytes (Cracked)

eval<>;END{print$x='x'}

Usage: takes one line of input of stdin and evals it. The END block keeps simple attempts like print"Hello, World!\n";exit from working.

Try it Online!

our $x;package X;require Tie::Scalar;@ISA=qw(Tie::Scalar);sub TIESCALAR{my$v;return bless\$v,'X';}sub STORE{}sub FETCH{return "Hello, World!\n"}tie $x,'X';

Chris

Posted 2017-08-05T17:21:06.367

Reputation: 1 313

Cracked – Felix Palmen – 2017-08-08T07:53:14.370

1

6502 machine code (C64), 94 bytes (Cracked)

00 C0 20 FD AE 20 9E AD 20 A3 B6 A0 00 B9 25 C0 C0 01 F0 21 C0 07 F0 1D C0 0B
F0 19 20 20 C0 C8 D0 EB 51 22 4C D2 FF F0 48 FA A2 1C 6D 72 30 06 A9 03 48 7C
A3 8D 48 C0 B9 26 C0 8D 45 C0 B9 27 C0 8D 46 C0 A2 00 BD FD AE 49 23 20 20 C0
C8 E8 E0 03 D0 F2 C0 0E D0 B5 49 1A 8D 18 D0 60

Disassembled:

00 C0       .WORD $C000       ; load address
20 FD AE    JSR $AEFD
20 9E AD    JSR $AD9E
20 A3 B6    JSR $B6A3
A0 00       LDY #$00
B9 25 C0    LDA $C025,Y
C0 01       CPY #$01
F0 21       BEQ $C033
C0 07       CPY #$07
F0 1D       BEQ $C033
C0 0B       CPY #$0B
F0 19       BEQ $C033
20 20 C0    JSR $C020
C8          INY
D0 EB       BNE $C00B
51 22       EOR ($22),Y
4C D2 FF    JMP $FFD2
F0 48       BEQ $C06F
FA          .BYTE $FA
A2 1C       LDX #$1C
6D 72 30    ADC $3072
06 A9       ASL $A9
03          .BYTE $03
48          PHA
7C A3       .WORD $A37C
8D 48 C0    STA $C048
B9 26 C0    LDA $C026,Y
8D 45 C0    STA $C045
B9 27 C0    LDA $C027,Y
8D 46 C0    STA $C046
A2 00       LDX #$00
BD FD AE    LDA $AEFD,X
49 23       EOR #$23
20 20 C0    JSR $C020
C8          INY
E8          INX
E0 03       CPX #$03
D0 F2       BNE $C044
C0 0E       CPY #$0E
D0 B5       BNE $C00B
49 1A       EOR #$1A
8D 18 D0    STA $D018
60          RTS

Online demo

Important: When load from disk (like in this online demo), the program only works after issuing a NEW command! Without first doing NEW, you'd only ever get an ?OUT OF MEMORY ERROR when trying to pass a string.


Usage: SYS49152,"[string]", where [string] is your input string.

Yes, input is a string this time, and the white area in the screenshot below doesn't tell you anything about the required length.

Screenshot

This should be quite hard to crack, but it's possible calculating everything back, no hashes or similar involved ;) You might need some reference for the C64 ROMs though. Further tip: look for an area only containing data in the disassembly listing :)

Like with my previous entry, here's a BASIC loader to paste into vice, just RUN this and the program is placed at $C000:

0fOa=49152to49243:rEb:pOa,b:nE
1dA32,253,174,32,158,173,32,163,182,160,0,185,37,192,192,1,240,33,192,7,240,29
2dA192,11,240,25,32,32,192,200,208,235,81,34,76,210,255,240,72,250,162,28,109
3dA114,48,6,169,3,72,124,163,141,72,192,185,38,192,141,69,192,185,39,192,141,70
4dA192,162,0,189,253,174,73,35,32,32,192,200,232,224,3,208,242,192,14,208,181
5dA73,26,141,24,208,96

Solution:

8bitsareenough

Explanation:

The code basically uses an XOR key of the same length as Hello, World!\n. As this would be quite simple to crack, the key isn't placed in the code as is but there are 3 times 3 bytes that are calculated from the C64's ROMs.

The 3 times 3 bytes in the data are in the format <key>, <low>, <high>, where <low>, <high> is the start address of 3 bytes in the ROM that are taken as part of our XOR key after XOR'ing them with <key>.

It's possible to crack it with some reference / disassembly to the C64 ROMs. Of course, it's easier to just try and get the key from the running program. I attempted to prevent the easiest method of doing this (just entering "Hello, World!\n", as XOR is reversed with the same key) by forcing a crash on wrong input. The crack linked cleverly modified the program, so it won't crash.

Another nice possibility to crack this would have been to spot the single place where output happens: EOR ($22),Y; JMP $FFD2. If you know that fetching a string using the BASIC routines will place a pointer to that string in $22/$23, all you have to do is set a breakpoint at EOR ($22),Y and get the XOR key delivered in the accumulator byte by byte.

Felix Palmen

Posted 2017-08-05T17:21:06.367

Reputation: 3 866

And cracked again. This is good fun!

– A Gold Man – 2017-08-15T07:08:11.030

So, unfortunately, I have to give up on this. I could come up with an even harder-to-crack one but 1.) this would increase byte count and 2.) it's too late anyways. Nice job! – Felix Palmen – 2017-08-15T07:33:15.140

0

PHP, 94 bytes, Cracked

<?=constant(explode(',',$argv[1])[0]."::".explode(',',$argv[1])[1])==262144?"Hello, world
":a;

Try it online! First codegolf submission, feel free to help me improve this

Cracked, intended input :

ReflectionFunction,IS_DEPRECATED

Because

ReflectionFunction::IS_DEPRECATED = 262144

LP154

Posted 2017-08-05T17:21:06.367

Reputation: 111

1Cracked. – nickb – 2017-08-07T12:13:39.327