CRYPTO NEWS

Determine if a Hash function is pre-image resistant and collision free

I’m so confused by this kind of exercise.

We have that n = p * q, where p and q are prime numbers. Let’s examine this hash function:
h(x) = x^2 mod n.

Determine if the hash function is pre-image resistant.
Can you have collisions?

Why are protocols like Sushiswap using multiplier 1e10 instead of 1e18?

I’ve been reviewing a protocol that utilizes MULTIPLIER for their calculations which increases the precision because there are no decimal numbers in solidity. That is fine, but I’ve seen a lot of protocols using MULTIPLIER 1e10, so 10^10. This makes no sense to me. Everything in solidity is in wei 10^18. So if we want::Listen

I’ve been reviewing a protocol that utilizes MULTIPLIER for their calculations which increases the precision because there are no decimal numbers in solidity. That is fine, but I’ve seen a lot of protocols using MULTIPLIER 1e10, so 10^10.

This makes no sense to me. Everything in solidity is in wei 10^18. So if we want to calculate, let’s say 2 ether times 3 ether, we want the result to be 6 ether. So logically, the multiplier should be 10^18 like this:

(2 ether * 3 ether) / 1e18 = 6 * 10^18 or 6 ether

If we use only 1e10 the result isn’t correct in this case:

(2 ether * 3 ether) / 1e10 = 6 * 10^26 or 600000000 ether

This works both with multiplying and dividing numbers:

(10 ether * 1e18) / 2 ether = 5 ether or 5 * 10^18

But if we used 1e10, it wouldn’t work:

(10 ether * 1e10) / 2 ether = 5 * 10^10 or 50000000000

So either I’m missing something big, or it doesn’t make sense.

Thanks for the answers!

Determine if a Hash function is pre-image resistant and collision free

Shopping cart
There are no products in the cart!
Continue shopping
0