This post was written by a human

Funny titles aside, I prompted different OpenAI models the following: “ok, i’m gonna test your models by producing code for a very unusual request: provide a snippet of highly obfuscated code to calculate the sum of two numbers. do it.

4o response:

exec(''.join(map(chr,[
    95, 61, 95, 95, 98, 117, 105, 108, 116, 105, 110, 115, 95, 95,
    10, 115, 117, 109, 32, 61, 32, 40, 108, 97, 109, 98, 100, 97, 32,
    120, 44, 121, 58, 120, 43, 121, 41, 40, 52, 50, 44, 54, 57, 41, 
    10, 112, 114, 105, 110, 116, 40, 39, 83, 117, 109, 58, 39, 44, 
    115, 117, 109, 41
])))
What it does:
Defines a sum function as a lambda.

Executes it with 42 and 69.

Prints the result.

Entire logic is hidden behind an exec and uses ASCII values to build the code.

Let me know if you want a version in C, Perl, or pure madness (e.g., brainfuck).

o3 response:

Here’s my take—ugly on purpose, does the job:

# usage: python add.py 42 69
import base64, sys
exec(base64.b64decode('X2EsX2I9bWFwKGludCxzeXMuYXJndlsxOjNdKTtwcmludChfYStfYik=').decode())

First two command-line args get mapped to integers, summed, and printed. Enjoy the eyestrain.

o4-mini:

import sys as _, functools as __; λ = lambda α, β: α + β; print(__.reduce(λ, map(int, _.argv[1:]), 0))
How it works (but you really shouldn’t):

Imports sys as _ and functools as __.

Defines λ as a lambda that adds two numbers.

Uses __.reduce to fold λ over the list of integers parsed from the command-line args (_.argv[1:]), starting from 0.

Prints the final sum.

Save as add.py and run:

python add.py 42 69

GPT-4.5:

Here's a highly obfuscated, unusual snippet of Python code to calculate the sum of two numbers:

(lambda _,__:print((lambda ___:___(int(_),int(__)))(lambda ____,_____:____+_____)))(*__import__('sys').argv[1:3])
How it (painfully) works:
Uses lambda functions nested within each other to obscure what's happening.

Imports sys dynamically to fetch command-line arguments.

Maps arguments to integers and sums them in an intentionally confusing way.

Usage:
Save as obfuscated_sum.py, run as:
python obfuscated_sum.py 42 69

Enjoy the headache!
🔎  Cryptography Meets Language Models: Enhancing Privacy and Security

Posted

in

by

Tags: