Obfunge
Jump to navigation
Jump to search
Obfunge is a Befunge-93 derivative invented by User:None1, it is Befunge-93 but obfuscated.
Instructions
Befunge-93 has the following commands:
Cmd | Description |
---|---|
!
|
Addition: Pop two values a and b, then push the result of a+b |
"
|
Subtraction: Pop two values a and b, then push the result of b-a |
#
|
Multiplication: Pop two values a and b, then push the result of a*b |
$
|
Integer division: Pop two values a and b, then push the result of b/a, rounded down. According to the specifications, if a is zero, ask the user what result they want. |
%
|
Modulo: Pop two values a and b, then push the remainder of the integer division of b/a. |
&
|
Logical NOT: Pop a value. If the value is zero, push 1; otherwise, push zero. |
'
|
Greater than: Pop two values a and b, then push 1 if b>a, otherwise zero. |
(
|
PC direction right |
)
|
PC direction left |
*
|
PC direction up |
+
|
PC direction down |
,
|
Random PC direction |
-
|
Horizontal IF: pop a value; set direction to right if value=0, set to left otherwise |
.
|
Vertical IF: pop a value; set direction to down if value=0, set to up otherwise |
/
|
Toggle stringmode (push each character's ASCII value all the way up to the next / )
|
0
|
Duplicate top stack value |
1
|
Swap top stack values |
2
|
Pop top of stack and discard |
3
|
Pop top of stack and output as integer |
4
|
Pop top of stack and output as ASCII character |
5
|
Bridge: jump over next command in the current direction of the current PC |
6
|
A "get" call (a way to retrieve data in storage). Pop two values y and x, then push the ASCII value of the character at that position in the program. If (x,y) is out of bounds, push 0 |
7
|
A "put" call (a way to store a value for later use). Pop three values y, x and v, then change the character at the position (x,y) in the program to the character with ASCII value v |
8
|
Get integer from user and push it |
9
|
Get character from user and push it |
:
|
End program |
;<=>?@ABCD
|
Equivalent to Befunge-93's 0 to 9
|
Do you think that's all? No! The program must be decrypted first!
Encryption is done using the following method:
e[i][j]=(a[i][j]+3*a[i][j-1]+5*a[i-1][j]-7*a[i-1][j-1])%94
Where e[i][j] stands for the encrypted character, a[i][j] stands for the original character, using this encoding:
(space)!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~
Decryption can be done like this:
a[i][j]=(e[i][j]-3*a[i][j-1]-5*a[i-1][j]+7*a[i-1][j-1])%94