Do irreversible operations exist? [closed]

2

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

Attention: Operations like 1 + 1 = 2 are not irreversible, because it is enough to know 2 operators, such as 1 and 2 that it is perfectly possible to discover the other value, solving a simple equation to find the value of x. or 1 + 1 = 2, if one has 2 values it would be the same as having x + 1 = 2. And another factor is that if a person is very interested in reversing an operation as 1 + 1 = 2, having only the value of 2, it would be like having x + y = 2, and (if not counting 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 math that when you enter a value, it returns another so that it is impossible to revert it to the original number? To make it easier, I'll give an example in c ++:

For this 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?

    
asked by anonymous 17.05.2018 / 19:41

1 answer

2

There are, and are called, hash functions.

"It is a method for transforming data in such a way that the result is (almost) unique. In addition, functions used in cryptography ensure that it is not possible for 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

  • It is not possible with this value to get the original word.
  • It is possible that some other word will end up generating this same value.
  • Some websites 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 to. what they did was write the word 'felipe' and create a table storing this information. that "felipe" is equal to 7e04da88cbb8cc933c7b89fbfe121cca in MD5

  • When you apply the hash function to a certain word, it must return the same value.

  • 17.05.2018 / 21:05