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 ?
Calculation of
hash
for example?– Ricardo Pontual
Explain this better, because most operations are irreversible.
– Maniero
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.– bfavaretto
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.
– Bacco