Suppose H(xy) = H(x) * H(y) . Clearly preimage properties are violated. How can we find x, y such that H(x) = H(y) mod (2^k)
-
1x=y would be an obvious solution. – Artjom B. Apr 21 '16 at 22:58
-
4I'm voting to close this question as off-topic because it is not a question directly related to programming. – Phiter Apr 21 '16 at 23:01
-
@PhiterFernandes Not all *tags* are directly related to programming. The justification of such tags, and such questions, is that these topics are manifestly *indirectly* related to programming. Computer programming doesn't have sharp boundaries. – John Coleman Apr 21 '16 at 23:04
-
I know, but this is sort of a math thing. – Phiter Apr 21 '16 at 23:07
-
If you define a hash function as a function which maps integers of arbitrary size to integers of a fixed size then the only hash functions that can satisfy your condition are hash functions whose values are always either 0 and 1, in which case your problem is trivially easy to solve. Perhaps you meant something like `H(ab) = H(a)H(b) mod 2^k` where the hash size is k-bits? – John Coleman Apr 21 '16 at 23:29
-
@JohnColeman - ya you are right. I should have written mod 2^k . If you can tell me the answers I would be really obliged to you. – Sumish Ajmani Apr 21 '16 at 23:44
-
@PhiterFernandes - if u know then plzz tell me or email me. I am eager to know this. – Sumish Ajmani Apr 21 '16 at 23:44
-
Sounds like homework. What have you tried? Also -- do you know of any hash functions which this property (other than `H(x) = x (mod 2^k)`)? – John Coleman Apr 21 '16 at 23:47
-
@JohnColeman - Actually the thing is the above problem was given with a hint related to use of Euler totient function ; presently I don't know the hash function, but i am sure you can surely use the above hint. – Sumish Ajmani Apr 22 '16 at 00:05
-
1Please see crypto.stackexchange.com for these kinds of questions. Some more background would likely be helpful to separate it from a basic homework question, however. – Rob Napier Apr 22 '16 at 00:37
-
Euler's theorem is probably what the hint is alluding to. – John Coleman Apr 22 '16 at 00:38
-
@JohnColeman : ya, that's what the hint was given. Any proceedings . update ?? I tried a lot using a fact about Euler totient function that x^(phi(2^k)) = 1 mod 2^k . But was unable to proceed – Sumish Ajmani Apr 23 '16 at 02:42
1 Answers
2^k
is a very special modulus. You can prove the following strengthened version of Euler's theorem:
Suppose that x
is any postive integer. Then x^phi(2^k) (mod 2^k)
is equal to either 0 or 1, with 1 if and only if x
is odd.
Proof:
If x
is odd, then gcd(x,2^k) = 1
, hence x^phi(2^k) (mod 2^k) = 1
by Euler's theorem.
Suppose that x
is even. The result is trivially true if x = 0
, so suppose that x > 0
. Write x = (2^s)*y
where y
is odd and s > 0
. Note that
phi(2^k)` = 2^(k-1)
But then,
x^phi(2^k) = (2^s*y)^phi(2^k)
= (2^s)^phi(2^k) * y^phi(2^k)
= 2^(s*phi(2^k)) * y^phi(2^k)
= 2^(s*2^(k-1)) * y^phi(2^k)
= 0 * y^phi(2^k) = 0 (mod 2^k)
the last line follows from the fact that s*2^(k-1) >= k
hence 2^(s*2^(k-1))
is a multiple of 2^k
.
Note that if x
is even then you actually have x^k = 0 (mod 2^k)
, so raising x
to the power phi(2^k)
is overkill for any but the smallest k
.
Given this lemma, it is now trivial to see that there exists distinct x
,y
with either H(x) = H(y) = 0
or H(x) = H(y) = 1
. Since it seems to be homework, I'll leave the details to you.

- 51,337
- 7
- 54
- 119