Advertisement
PikMike

Untitled

Apr 17th, 2016
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.66 KB | None | 0 0
  1. #!/usr/bin/python3
  2.  
  3. # from secretkey import secret_func
  4.  
  5. from math import *
  6.  
  7. def f(x):
  8.     # return -(127 * (math.log(3 * math.cos(x / 2) - 2 * math.sin(x / 2)) - log(3 * math.sin(x / 2) + 2 * math.cos(x / 2)))) / math.pi
  9.     return -127 * log(-tan(x / 2 - atan2(3, 2))) / pi
  10.  
  11. def s(f, x):
  12.     return (f(x + 0.001) - f(x)) / 0.001
  13.  
  14. def encrypt(f, a, m):
  15.     y0 = f(a)
  16.     y1 = f(m)
  17.     s0 = s(f, a)
  18.     s1 = s(f, m)
  19.     if s0 == s1: return "NULL"
  20.     x = (y1-y0 + s0*a - s1*m)/(s0-s1)
  21.     return (x, s1*(x-m) + y1)
  22.  
  23. a = -9/4 * math.pi
  24.  
  25. # l = input("What is the message? ")
  26. # for c in map(ord, l):
  27. #     print(encrypt(secret_func, a, c))
  28.  
  29. print(f(a))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement