Decoding of an encrypted text with a not specified crypt-key in python

Viewed 110

The following message is given in code:

V C Z J C Z I Z J M Z J L X Y H M J Y H E M C W S J M W Z ​​N C X W J S Y Q X W Z C O X J H M C J D V S O J H Y ​​H W W Z O H @

Write a program that proposes possible decryption of the same knowing that the original message is in LATIN and that a character has also been used for space (the J character). Additional information:

  • It is a code that uses a formula y = f (x) mod p with p a prime
  • It is important to know what we are talking about
  • The message gives information for project 2

Do some of you know how to resolve this in python?

1 Answers

If you take several consecutive letters:

S (19) -> M (13)
T (20) -> C (3)
U (21) -> V (22)
V (22) -> L (12)

and assume that p = 29, you can see that the increment between successive letters (mod 29) is 19.

Therefore: f(x) = 19*x.

Note that f(x) mod p is the method of encryption. I leave it as an exercise for the reader to determine how to decrypt.

Related