0
$\begingroup$

If a hash function is written:

Hash(Hello||World)

Is that equivalent to Hash(Hello) + Hash(World) or Hash(HelloWorld) ?

Similarly, is there any difference between Hash(Hello||World) and Hash(Hello,World)?

$\endgroup$
2
$\begingroup$

Typically, the notation || means concatenation, which is to say Hello||World is equivalent to HelloWorld.

Is that equivalent to Hash(Hello) + Hash(World) or Hash(HelloWorld)?

So Hash(Hello||World) is equivalent to Hash(HelloWorld).

Is there any difference between Hash(Hello||World) and Hash(Hello,World)?

This depends entirely on what Hello,World is defined to mean.

Notation does not have absolutely defined meaning - what a symbol means in one context can be different from what that symbol means in another context.

The only way to know for sure is to check the definitions of the notation from wherever you found this.

If there are no such definitions, then it is safe to assume the most common/obvious meaning for the notation. However, if the notation is non-standard, then there may not be a common and obvious meaning for it.

$\endgroup$
  • 2
    $\begingroup$ Typically if $H$ is some kind of ‘hash function’, $H(r, m)$ means the hash of some unique encoding of the tuple $(r, m)$ so that hashing Hello and World doesn't coincide with hashing Hell and oWorld, which may be $r \mathbin\| m$ if $r$ is fixed-length, or may actually fail to be unique leading to collisions in the hash if you're a Swiss election authority. $\endgroup$ – Squeamish Ossifrage Mar 28 at 18:25
-2
$\begingroup$

I think you are confusing hash functions with homomorphic encryption. No, you cannot combine separate hash results mathematically (add, xor, etc.) and expect the same result. Any hash worth its salt will not allow that. Otherwise, it would be trivial to break the hash with lookup tables of partial results.

$\endgroup$
  • 3
    $\begingroup$ It's really unclear what part of the question "No" is an answer to. $\endgroup$ – Macil Mar 28 at 23:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.