A
A
Alexey Yarkov2016-08-09 20:21:22
Algorithms
Alexey Yarkov, 2016-08-09 20:21:22

Is there an algorithm where the cipher text is different, but the decrypted text is the same?

I asked myself one question here:
We have a bash script that hangs on a git hook before commit.
A browser is called from the script with a specific URL.
The URL is a page with a form with questions and answers.
Fill out the form and click the "Get Code" button.
Using JS we generate the code.
We copy.
We return to the terminal and enter the code.
In the bash script, we decrypt the code and if the answer is TRUE, then we allow the commit, but if it is FALSE, we forbid it.
Smells like idiocy, but nonetheless)))

Answer the question

In order to leave comments, you need to log in

3 answer(s)
R
Rsa97, 2016-08-09
@Rsa97

The usual asymmetric scheme.
The bash script passes a random query string in the URL, the server encrypts it with its own key, and passes it back to the script. If, after decryption with a paired key, the lines matched - bingo.

G
GavriKos, 2016-08-09
@GavriKos

Many algorithms will suit your task. The only question is sustainability. If you don't want to mess around with cryptography - please - consider, for example, a banal sum of ASCII codes - you need it to be equal to a constant. You can further develop the topic with the formula what kind of thread. Again - a simple literal constant code, "diluted" with randomness (we look only at odd characters), etc. etc. In general, the statement in the title is incorrect - you do not need the "decrypted text" at all. You just need to be able to generate n rows that match the same condition.

A
Andrew, 2016-08-09
@OLS

Yes, this is generally a good form rule for cryptography. Because otherwise, an attacker, seeing the same ciphertext, could guess the essence of the message. For example, in block ciphers, this is achieved by the so-called IV - initial vector, which is transmitted in clear text at the beginning of the message, but radically changes the cipher text (naturally, the decrypted text remains the same). In asymmetric cryptography, in general, the body text is encrypted with a randomly generated session key on the go, and the session key itself is attached to the message, being encrypted with an asymmetric cipher.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question