Do irreversible operations exist?

Asked

Viewed 186 times

2

In mathematics (therefore in programming) there are mathematical operations (+,-,*,/). But all the mathematical operations I know are perfectly reversible, for example, by dividing a number, I could multiply it and so the operation was "reversed".

Attention: Operations such as 1+1=2 are not irreversible, because one only needs to know 2 operators, such as 1 and 2 that is perfectly possible to discover the other value, solving a simple equation to discover the value of x. ie 1+1=2, If someone has 2 values it would be the same as x+1=2. And another factor is that if a person is very interested in reversing an operation like 1+1=2, having only the value of 2, it would be like having x+y=2, and (if you don’t count the negative numbers), the scenarios are limited:

x=1 and y=1

x=0 and y=2

x=2 and y=0

Is there any function, in programming or mathematics, that by inserting a value, it returns another in a way that is impossible to revert it to the original number ? To facilitate, I will give an example in c++:

For that function:

int divide(int num, int opera){
num = (num/opera);
return num;
}

There is this "counter function":

int multiplica(int num, int opera){
num = (num * opera);
return num;
}

Is there a function that returns a number that is impossible to get the old number ?

  • 2

    Calculation of hash for example?

  • 5

    Explain this better, because most operations are irreversible.

  • 1

    if a person is very interested in reversing an operation like 1+1=2, having only the value of 2, it would be like having x+y=2, and (if you don’t count the negative numbers), the scenarios are limited. This is true for any operation with 2+ unknowns, including hash functions. If x+y=2 has a limited number of solutions with positive integers, hash functions also have, only that this number is much higher. A good hash has so many possibilities for the values that generated them that it would take too long to test all of them to "break" the hash.

  • 4

    This question has some mathematical examples that do not proceed. "Operations like 1+1=2 are not irreversible," - What do you mean? I give you number three, I doubt you can guess which two numbers I put together to get that number. Similarly, the codes presented do not complement each other (one does not give the other’s answer if you only have the result). If you’re going to post a theoretical question, I think it’s best to leave more substantiated examples to be sure what it is exactly. And if you put weird restrictions (like "you can only use 1, 2, 4 and 8 to add, and not repeat"), then even HASH is reversible.

1 answer

2


They exist, and are called Hash functions.

"It is a method to transform data in such a way that the result is (almost) unique. In addition, functions used in cryptography ensure that it is not possible from a hash value to return to the original information." Wikipedia.

in database are commonly used to store passwords, MD4 and MD5 or SHA-1 are examples of famous hash functions.

for example, in the MD5 algorithm the word "Felipe" has the value 7e04da88cbb8cc933c7b89fbfe121cca

  1. it is not possible with this value to obtain the original word.
  2. it is possible that some other word ends up generating this same value.
  3. Some sites offer the option to find out what this value means in MD5, but that does not mean that it was able to decrypt this value, because there is no way. what they did was write the word 'Elipe' and create a table keeping this information. that "Elipe" is equal to 7e04da88cbb8cc933c7b89fbfe121cca on MD5

  4. whenever you apply the hash function to a certain word, you must return the same value.

  • Interestingly, there are several Hash ? functions (if yes, which one is the best ?) How could I use them in my software ? Is it possible to use them in the real world, that is, to encrypt something using paper and pen, or is it so difficult that it is impossible ? they have open code ?

  • 1

    Yes there are many Hash functions, The most used hash algorithms are the 16 bytes (or 128 bits, Digest size) MD4 and MD5 or the SHA-1, 20 bytes (160 bits). the fact is that you can create simple hash functions, yes on paper and pen. provided they meet the principles of the hash. , an example function: a function that takes a string and answers the sum of the number of characters. is a valid hash function, will not be good, but is valid. receives "Felipe" answer 6. receives "ana" answer 3. receives "rafael" answer 6. realize that rafael and Felipe have equal answers.

  • 2

    MD5 and even SHA-1 are deprecated for some time, prefer to use some algorithm of family SHA-2. And @silas333, virtually every language - I’d say most of the most commonly used - has hash functions available, either natively or via libraries. These are very complicated and impractical calculations to do with pen and paper.

  • 4

    By the answer we see that the question has problems (and if this is the correct answer, the question at least needs to be edited to reflect this). Hash is not a "mathematical operation". It is complex algorithms that depend on intermediate states and a number of other factors.

  • I agree that the question is ambiguous, but he asks a question internally to his question: Is there any function, in programming or mathematics, that by inserting a value, it returns another in a way that is impossible to revert it to the original number ? so I answered that there is yes, a function that does that.

  • 1

    @Luisfelipe nothing against the answer. The problem is only that without it, the question does not make it clear whether the subject is the same, besides starting from wrong premises. If the question is edited to better reflect what was asked, it adds more value..

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.