0

I am doing a cryptography program in Python.

It consists in reading a random phrase, like HELLO. Then it assigns it's respective ASCII values like:

H = 72, E = 79.

Then, using Pythagoras' Theorem, it creates two numbers C1 and C2, like this:

C1 = sqrt(A^2 + (A+B)^2);
C2 = sqrt(B^2 + (A+B)^2)

I actually figured out how to solve the equations for B and A, but...It gives me a whole bunch of possible values for A and B. Is there any way by codding to select the ones I actually need?

Or just throw away that idea?

Do you have examples for encryptation on python?

  • Where do `A` and `B` come from? – TigerhawkT3 Aug 15 '15 at 00:36
  • 4
    Please do not write your own crypto code. I say this because you don't seem attached to this particular method of 'encryption', which might indicate that you just want some kind of encryption. If that is the case, use something written by people who know what they're doing. That's not an insult; I myself would not write my own crypto code for real-world use. – Cyphase Aug 15 '15 at 00:38
  • Encrypt/Decrypt in python: https://pypi.python.org/pypi/simple-crypt – Paul Aug 15 '15 at 00:43
  • A and B are the H and E...But i meant it to be donde for every character in the ASCII – Carlos Martínez Aug 15 '15 at 00:53
  • 1
    A right triangle with two given legs will have a single possible hypotenuse, but a single hypotenuse can be part of an infinite number of right triangles. If all you have is the hypotenuse, it is not possible to determine the exact length of each leg of the original triangle. Don't roll your own crypto. – TigerhawkT3 Aug 15 '15 at 00:57
  • But a pair of hypotenuses wont have at least 1 solution? – Carlos Martínez Aug 15 '15 at 01:06
  • @Carlos Martinez You need a unique solution, not "at least 1", don't you? – saulspatz Aug 15 '15 at 01:20
  • I am having 4 answers, I need to figure out how to chose the correct one... – Carlos Martínez Aug 15 '15 at 01:33
  • What are the 4 answers? – saulspatz Aug 15 '15 at 03:22

0 Answers0