Skip to content

Instantly share code, notes, and snippets.

@fionafibration
Last active June 13, 2019 01:25
Show Gist options
  • Save fionafibration/7b8ce7cec7656c62773c2b4ca9370580 to your computer and use it in GitHub Desktop.
Save fionafibration/7b8ce7cec7656c62773c2b4ca9370580 to your computer and use it in GitHub Desktop.
Obfuscated Hello World in Python 3
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define w(h)copysign(1.0,h)
typedef int D;typedef float I;struct _{I a;I b;};typedef struct _ F;D f(D p){if(p<1){return 1;}else{return p*f(
p-1);}}I u(D s){I z=0;for(D k=0;k<s;k++){z+=pow(-1,k)*(f(6*k))/((pow(f(k),3))*(f(3*k)))*(13591409+545140134*k)/
(pow(640320,(3*k)));}return pow((z*pow(10005,0.5)/4270934400),-1);}I e(D n){I j=2;for(D i=2;i<n;i++){j+=1.0/f(i
);}return j;}I r(I h,I g){if(h>1.0||h<-1.0){return-r(1.0/h,g)+w(h)*g/2.0;}if(h==1.0||h==-1.0){return g/4.0;}I j
=0.0;for(D z=0;z<100;z++){j+=pow(-1.0,(I)z)*(pow(h,(2.0*(I)z+1.0))/(2.0*(I)z+1.0));}return j;}F s(I n,I g,I a[]
){if(n<-g/2.0||n>g/2.0){F j;if(n<0){j=s(n+g,g,a);}else{j=s(n-g,g,a);}I x=j.a;I y=j.b;F v={-x,-y};return v;}I x=
1.0,y=0.0;for(D i=0;i<50;i++){I d=w(n);I u=x,v=y;x=u-(d*pow(2.0,-i)*v);y=(d*pow(2.0,-i)*u)+v;n=n-(d*a[i]);}I k=
0.6072529350088814;F value={x*k,y*k};return value;}I h(I a,I b){I u,x;D v,y;u=frexp(a,&v);x=frexp(b,&y);I h=u*x
;I j=v+y;return ldexp(h,j);}D t(D s){D k=0;while(s>0){k++;s>>=1;}return k;}D j(D e,D h){if(e<10||h<10){return e
*h;}D y=(t(e)>t(h)? t(e): t(h))/2.0;D l=pow(2.0,y);D a=e/l;D b=e%l;D c=h/l;D d=h%l;D u=j(a,c);D v=j(b,d);D z=j(
a+b,c+d)-u-v;return u*pow(2,(y*2))+(z*l)+v;}I m(I a,I b){double x,y,u,v;x=modf(a,&y);u=modf(b,&v);return h(x,u)
+h(y,u)+h(x,v)+j(y,v);}F o(F a,F b){I x=a.a,y=a.b;I u=b.a,v=b.b;F r={m(x,u)-m(y,v),m(x,v)+m(y,u)};return r;}F k
(F p,I g,I b,I a[]){I q=pow(b,p.a);F v=s(p.b,g,a);F r={v.a*q,v.b*q};return r;}void dark_magic(I c[],size_t f,D
l){I g=u(5);I b=e(30);I a[50];for(D i=0;i<50;i++){a[i]=r(pow(2.0,-i),g);}for(D i=0;i<l;i++){I s[f/2];for(D j=0;
j<f;j+=2){F z={c[j],c[j+1]};F x={0.0,2.0};F v={g*j*i/f,0.0};s[j/2]=o(z,k(o(v,x),g,b,a)).a;}I out=0;for(D j=0;j<
f/2;j++){out+=s[j];}putchar(round(out/(f/2)));}}D main(){/* Hello World Abomination in C by Finian Blackett */
I c[]={1129.0,0.0,23.49715586796887,22.211581739879684,-179.7230388530905,-157.5036698239512,
7.806224011347112,20.798766949019274,4.275687275221713,-116.59625874580514,-3.9410319705666126,
-17.579175939686984,51.58500366911933,-6.977531208354918,51.58500366911933,6.977531208354918,
-3.9410319705666126,17.579175939686984,4.275687275221713,116.59625874580514,7.806224011347112,
-20.798766949019274,-179.7230388530905,157.5036698239512,23.49715586796887,-22.211581739879684
};D l=13;dark_magic(c,sizeof(c)/sizeof(c[0]),l);}
from decimal import Decimal as d
from math import frexp as p, ldexp as q, modf as t
def w(h):
return (h > 0) - (h < 0) or 1
def f(p):
if p < 1:
return 1
else:
return p * f(p - 1)
def u(s):
z = d(0)
for k in range(s):
z += (d(-1) ** k) * (
d(f(6 * k)) / ((f(k) ** 3) * (f(3 * k))) * (13591409 + 545140134 * k) / (640320 ** (3 * k)))
return float((z * d(10005 ** 0.5) / 4270934400) ** (-1))
g = u(5)
def e(s):
j = 2
for i in range(2, s):
j += 1 / f(i)
return j
b = e(50)
def r(h):
if h > 1 or h < -1:
return -r(1 / h) + w(h) * g / 2
elif h == 1 or h == -1:
return g / 4
j = 0
for z in range(80):
j += (-1) ** z * (h ** (2 * z + 1)) / (2 * z + 1)
return j
a = [r(2 ** (-i)) for i in range(30)]
def s(n):
if n < -g / 2 or n > g / 2:
if n < 0:
x, y = s(n + g)
else:
x, y = s(n - g)
return -x, -y
x, y = 1, 0
for i in range(30):
d = 1.0 * w(n)
u, v = x, y
x = u - (d * (2 ** (-i)) * v)
y = (d * (2 ** (-i)) * u) + v
n = n - (d * a[i])
return 0.6072529350088814 * x, 0.6072529350088814 * y
def h(a, b):
u, v = p(a)
x, y = p(b)
h, j = u * x, int(v + y)
return q(h, j)
def j(e, h):
if e < 10 or h < 10:
return e * h
y = max(e.bit_length(), h.bit_length()) // 2
a = e // 2 ** y
b = e % 2 ** y
c = h // 2 ** y
d = h % 2 ** y
u = j(a, c)
v = j(b, d)
z = j(a + b, c + d) - u - v
return u * 2 ** (y * 2) + (z * 2 ** y) + v
def m(a, b):
x, y = t(a)
u, v = t(b)
return h(x, u) + h(y, u) + h(x, v) + j(int(y), int(v))
def o(h, e):
x, y = h
u, v = e
return m(x, u) - m(y, v), m(x, v) + m(y, u)
def k(p):
q = b ** p[0]
h, z = s(p[1])
return h * q, z * q
def dark_magic():
return [print(chr(int(round(sum(x[0] for x in [o((c[a], c[a + 1]), k(o([0, 2], [g * a * n / len(c), 0])))
for a in range(0, len(c), 2)]) / (len(c) / 2)))), end="") for n in range(l)]
c, l = [1129.0,
0.0,
23.49715586796887,
22.211581739879684,
-179.7230388530905,
-157.5036698239512,
7.806224011347112,
20.798766949019274,
4.275687275221713,
-116.59625874580514,
-3.9410319705666126,
-17.579175939686984,
51.58500366911933,
-6.977531208354918,
51.58500366911933,
6.977531208354918,
-3.9410319705666126,
17.579175939686984,
4.275687275221713,
116.59625874580514,
7.806224011347112,
-20.798766949019274,
-179.7230388530905,
157.5036698239512,
23.49715586796887,
-22.211581739879684], 13
dark_magic()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment