Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re^2: crypto with core modules only

by dave_the_m (Monsignor)
on Aug 28, 2018 at 15:10 UTC ( #1221272=note: print w/replies, xml ) Need Help??

in reply to Re: crypto with core modules only
in thread crypto with core modules only

That is very insecure. It's basically adding the same set of 13 numbers in a cycle to each 13th character of the plaintext. You can eliminate the key from the cyphertext by calculating something along the lines of
$diff[$_] = $cyphertext[$_] - $cyphertext[$_+13] for 0..(@cyphertext +- 13);
You then end up with this equivalence for all the chars in the plaintext, apart from the first and last 13:
$diff[$_] == $plaintext[$_] - $plaintext[$_+13];
From there it's fairly easy to deduce what @plaintext is, especially if a few chars of the plaintext are known or can be guessed.


Replies are listed 'Best First'.
Re^3: crypto with core modules only
by tobyink (Abbot) on Aug 28, 2018 at 18:36 UTC

    It's called a Vigenere cipher, and this variant is an especially weak variant because the length of the key is known to be 13 characters. It is somewhat more secure if the key length isn't known to the attacker.

    If the key length is variable, for long ciphertexts, there are algorithms that can quickly yield the plaintext. For very short cipertexts, it's a lot more secure than you might think. If the key is as long as the message, it's basically a one-time pad.

Re^3: crypto with core modules only
by stevieb (Abbot) on Aug 28, 2018 at 15:46 UTC

    Thanks Dave,

    I figured it's terribly insecure, but the original premise was helping someone do some simple obfu that could be encoded in hex and then decoded. Security wasn't really part of the deal.

    It was a uni project for the person and we kind of collaborated outside of any forums. A learning exercise essentially.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1221272]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2019-07-23 11:42 GMT
Find Nodes?
    Voting Booth?
    If you were the first to set foot on the Moon, what would be your epigram?

    Results (24 votes). Check out past polls.