Universal hash functions with homomorphic XOR propertyIs (AES-)GCM parallelizable?Is this a correct understanding of Universal Hash Functions?Difficulty of forging MACs based on linear functions over $GFleft(2^nright)$

Has there been any indication at all that further negotiation between the UK and EU is possible?

How can I get my left hand to sound legato when I'm leaping?

Do I have to explain the mechanical superiority of the player-character within the fiction of the game?

What can I do with a research project that is my university’s intellectual property?

Is there a term for the belief that "if it's legal, it's moral"?

Constitutionality of U.S. Democratic Presidential Candidate's Supreme Court Suggestion

When to remove insignificant variables?

How do I professionally let my manager know I'll quit over an issue?

Loss of power when I remove item from the outlet

Should I include an appendix for inessential, yet related worldbuilding to my story?

Counterfeit checks were created for my account. How does this type of fraud work?

Count All Possible Unique Combinations of Letters in a Word

Ruining the family name

Why isn't my calculation that we should be able to see the sun well beyond the observable universe valid?

Get list of shortcodes from content

How to maintain a closed environment for one person for a long period of time

Can I enter the UK for 24 hours from a Schengen area, holding an Indian passport?

Should an enameled cast iron pan be seasoned?

How long would it take to cross the Channel in 1890's?

UK - Working without a contract. I resign and guy wants to sue me

How does DC work with natural 20?

Does the monk's Step of the Wind feature activate the benefit of the Mobile feat?

If the Dragon's Breath spell is cast on a familiar, does it use the wizard's DC or familiar's DC?

Why does using different ArrayList constructors cause a different growth rate of the internal array?



Universal hash functions with homomorphic XOR property


Is (AES-)GCM parallelizable?Is this a correct understanding of Universal Hash Functions?Difficulty of forging MACs based on linear functions over $GFleft(2^nright)$






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4












$begingroup$


Let $H = h_r : U rightarrow [m]$. What are the currently known most efficient algorithms such that $H$



  • is a universal family and

  • fulfils the homomorphic XOR operation property $forall h in H forall x,y in U: h(x oplus y) = h(x) oplus h(y)$?









share|improve this question









$endgroup$


















    4












    $begingroup$


    Let $H = h_r : U rightarrow [m]$. What are the currently known most efficient algorithms such that $H$



    • is a universal family and

    • fulfils the homomorphic XOR operation property $forall h in H forall x,y in U: h(x oplus y) = h(x) oplus h(y)$?









    share|improve this question









    $endgroup$














      4












      4








      4


      2



      $begingroup$


      Let $H = h_r : U rightarrow [m]$. What are the currently known most efficient algorithms such that $H$



      • is a universal family and

      • fulfils the homomorphic XOR operation property $forall h in H forall x,y in U: h(x oplus y) = h(x) oplus h(y)$?









      share|improve this question









      $endgroup$




      Let $H = h_r : U rightarrow [m]$. What are the currently known most efficient algorithms such that $H$



      • is a universal family and

      • fulfils the homomorphic XOR operation property $forall h in H forall x,y in U: h(x oplus y) = h(x) oplus h(y)$?






      universal-hash






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jun 4 at 11:15









      Martin KrommMartin Kromm

      485




      485




















          2 Answers
          2






          active

          oldest

          votes


















          6












          $begingroup$

          I believe that the internal GHASH function from GCM would meet that criteria (if you trim off the length word, and require universality only with equal length inputs [1]); it can be defined as:



          $$operatornameGHASH_k( M_n, M_n-1, …, M_0 ) = sum k^i M_i$$



          With the input $M_n, M_n-1, ..., M_0$ being the input message divided into 128 bit blocks, $k$ being the universal hash key, and the arithmetic (both the additions and the multiplications) done over the field $operatornameGF(2^128)$



          It meets the criteria:



          • It is universal (for equal length messages); for random $k$ and any two distinct equal length messages $M, M'$, we have $operatornameGHASH_k(M) = operatornameGHASH_k(M')$ with probability $le |M| / 2^128$


          • It meets your homomophic requirement; this is because addition in $operatornameGF(2^128)$ is exclusive-or, and we have $k^i M_i oplus k^i M'_i = k^i( M_i oplus M'_i)$


          • It is quite efficient (especially with AES-NI instructions); I can't say that it's the most efficient possible...



          [1]: You cannot get both the homomorphic properties and the universality (across messages of different lengths) to hold simultaneously. The homomorphic property requires that $h_k(0) = 0$ and that $h_k(00) = 0$, hence we have two different messages $0$ and $00$ which hash to the same value with high probability (actually, 1), thus $h_k$ is not a universal hash family.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Surely you mean CLMUL, not AES-NI?
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:01










          • $begingroup$
            @SqueamishOssifrage Even though technically CLMUL isn't contained in the AES-NI, they usually appear together, so many people consider CLMUL to be part of AES-NI for all practical intents and purposes...
            $endgroup$
            – SEJPM
            Jun 4 at 16:02


















          3












          $begingroup$

          Any polynomial evaluation hash or polynomial division hash, without length padding, has the property you seek:



          • Polynomial evauation. If $H_r(m) = m(r)$ where $m$ is a polynomial of zero constant term and degree $ell$ over some field and $r$ is an element of the field, then we have $$H_r(m) = m_1 r^ell + m_2 r^ell-1 + cdots + m_ell-1 r^2 + m_ell r,$$ so clearly $H_r(m + m') = H_r(m) + H_r(m')$. Standard examples of this form are Poly1305 and GHASH. If the field has characteristic 2, as in GHASH, then $+$ is xor. This obviously generalizes to multivariate polynomials too, e.g. the dot product $H_r_1,r_2(m_1 mathbin| m_2) = m_1 r_1 + m_2 r_2$ (which naturally attains a lower collision probability).



          • Polynomial division. If $H_f(m) = (m cdot x^n) bmod f$ where $m, f in operatornameGF(p)[x]$, and where $f$ is irreducible and of degree $n$, then clearly



            beginalign
            H_f(m + m')
            &= bigl[(m + m') cdot x^nbigr] bmod f \
            &= (m cdot x^n) bmod f + (m' cdot x^n) bmod f \
            &= H_f(m) + H_f(m').
            endalign



            Polynomial division hashes are related to CRCs and Rabin fingerprints. When $p = 2$, $+$ is xor.



          Beware that multiplication in fields of characteristic 2 is generally not efficient in software, and that the most efficient software is riddled with timing side channels—unless you can fruitfully organize your computation to simultaneously compute a batch of (say) 64 instances of it in parallel using bitslicing.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Marim specifically asked it to be homomorphic over XOR; hence you're stuck with a field with characteristic 2.
            $endgroup$
            – poncho
            Jun 4 at 15:45










          • $begingroup$
            @poncho Yes. Just wanted to make sure that Martin is aware that characteristic 2 is dangerous in software!
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 15:46











          • $begingroup$
            Actually I think that one could get say 64 parallel instances going using what poncho outlined in this older answer.
            $endgroup$
            – SEJPM
            Jun 4 at 16:04










          • $begingroup$
            @SEJPM Yes, but you need your message to be at least $8k$ bytes long to get at most a factor of $k$ improvement, and it's not a priori clear where the performance cutoff will be between a leaky table-driven implementation and a safe bitsliced implementation. My point is just that characteristic 2 can be dangerous for software because it requires you to do this analysis and tempts you into security-damaging performance tradeoffs.
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:14












          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "281"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f71048%2funiversal-hash-functions-with-homomorphic-xor-property%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          6












          $begingroup$

          I believe that the internal GHASH function from GCM would meet that criteria (if you trim off the length word, and require universality only with equal length inputs [1]); it can be defined as:



          $$operatornameGHASH_k( M_n, M_n-1, …, M_0 ) = sum k^i M_i$$



          With the input $M_n, M_n-1, ..., M_0$ being the input message divided into 128 bit blocks, $k$ being the universal hash key, and the arithmetic (both the additions and the multiplications) done over the field $operatornameGF(2^128)$



          It meets the criteria:



          • It is universal (for equal length messages); for random $k$ and any two distinct equal length messages $M, M'$, we have $operatornameGHASH_k(M) = operatornameGHASH_k(M')$ with probability $le |M| / 2^128$


          • It meets your homomophic requirement; this is because addition in $operatornameGF(2^128)$ is exclusive-or, and we have $k^i M_i oplus k^i M'_i = k^i( M_i oplus M'_i)$


          • It is quite efficient (especially with AES-NI instructions); I can't say that it's the most efficient possible...



          [1]: You cannot get both the homomorphic properties and the universality (across messages of different lengths) to hold simultaneously. The homomorphic property requires that $h_k(0) = 0$ and that $h_k(00) = 0$, hence we have two different messages $0$ and $00$ which hash to the same value with high probability (actually, 1), thus $h_k$ is not a universal hash family.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Surely you mean CLMUL, not AES-NI?
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:01










          • $begingroup$
            @SqueamishOssifrage Even though technically CLMUL isn't contained in the AES-NI, they usually appear together, so many people consider CLMUL to be part of AES-NI for all practical intents and purposes...
            $endgroup$
            – SEJPM
            Jun 4 at 16:02















          6












          $begingroup$

          I believe that the internal GHASH function from GCM would meet that criteria (if you trim off the length word, and require universality only with equal length inputs [1]); it can be defined as:



          $$operatornameGHASH_k( M_n, M_n-1, …, M_0 ) = sum k^i M_i$$



          With the input $M_n, M_n-1, ..., M_0$ being the input message divided into 128 bit blocks, $k$ being the universal hash key, and the arithmetic (both the additions and the multiplications) done over the field $operatornameGF(2^128)$



          It meets the criteria:



          • It is universal (for equal length messages); for random $k$ and any two distinct equal length messages $M, M'$, we have $operatornameGHASH_k(M) = operatornameGHASH_k(M')$ with probability $le |M| / 2^128$


          • It meets your homomophic requirement; this is because addition in $operatornameGF(2^128)$ is exclusive-or, and we have $k^i M_i oplus k^i M'_i = k^i( M_i oplus M'_i)$


          • It is quite efficient (especially with AES-NI instructions); I can't say that it's the most efficient possible...



          [1]: You cannot get both the homomorphic properties and the universality (across messages of different lengths) to hold simultaneously. The homomorphic property requires that $h_k(0) = 0$ and that $h_k(00) = 0$, hence we have two different messages $0$ and $00$ which hash to the same value with high probability (actually, 1), thus $h_k$ is not a universal hash family.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Surely you mean CLMUL, not AES-NI?
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:01










          • $begingroup$
            @SqueamishOssifrage Even though technically CLMUL isn't contained in the AES-NI, they usually appear together, so many people consider CLMUL to be part of AES-NI for all practical intents and purposes...
            $endgroup$
            – SEJPM
            Jun 4 at 16:02













          6












          6








          6





          $begingroup$

          I believe that the internal GHASH function from GCM would meet that criteria (if you trim off the length word, and require universality only with equal length inputs [1]); it can be defined as:



          $$operatornameGHASH_k( M_n, M_n-1, …, M_0 ) = sum k^i M_i$$



          With the input $M_n, M_n-1, ..., M_0$ being the input message divided into 128 bit blocks, $k$ being the universal hash key, and the arithmetic (both the additions and the multiplications) done over the field $operatornameGF(2^128)$



          It meets the criteria:



          • It is universal (for equal length messages); for random $k$ and any two distinct equal length messages $M, M'$, we have $operatornameGHASH_k(M) = operatornameGHASH_k(M')$ with probability $le |M| / 2^128$


          • It meets your homomophic requirement; this is because addition in $operatornameGF(2^128)$ is exclusive-or, and we have $k^i M_i oplus k^i M'_i = k^i( M_i oplus M'_i)$


          • It is quite efficient (especially with AES-NI instructions); I can't say that it's the most efficient possible...



          [1]: You cannot get both the homomorphic properties and the universality (across messages of different lengths) to hold simultaneously. The homomorphic property requires that $h_k(0) = 0$ and that $h_k(00) = 0$, hence we have two different messages $0$ and $00$ which hash to the same value with high probability (actually, 1), thus $h_k$ is not a universal hash family.






          share|improve this answer











          $endgroup$



          I believe that the internal GHASH function from GCM would meet that criteria (if you trim off the length word, and require universality only with equal length inputs [1]); it can be defined as:



          $$operatornameGHASH_k( M_n, M_n-1, …, M_0 ) = sum k^i M_i$$



          With the input $M_n, M_n-1, ..., M_0$ being the input message divided into 128 bit blocks, $k$ being the universal hash key, and the arithmetic (both the additions and the multiplications) done over the field $operatornameGF(2^128)$



          It meets the criteria:



          • It is universal (for equal length messages); for random $k$ and any two distinct equal length messages $M, M'$, we have $operatornameGHASH_k(M) = operatornameGHASH_k(M')$ with probability $le |M| / 2^128$


          • It meets your homomophic requirement; this is because addition in $operatornameGF(2^128)$ is exclusive-or, and we have $k^i M_i oplus k^i M'_i = k^i( M_i oplus M'_i)$


          • It is quite efficient (especially with AES-NI instructions); I can't say that it's the most efficient possible...



          [1]: You cannot get both the homomorphic properties and the universality (across messages of different lengths) to hold simultaneously. The homomorphic property requires that $h_k(0) = 0$ and that $h_k(00) = 0$, hence we have two different messages $0$ and $00$ which hash to the same value with high probability (actually, 1), thus $h_k$ is not a universal hash family.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jun 4 at 14:39









          Squeamish Ossifrage

          28.8k144122




          28.8k144122










          answered Jun 4 at 12:30









          ponchoponcho

          96k2155250




          96k2155250











          • $begingroup$
            Surely you mean CLMUL, not AES-NI?
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:01










          • $begingroup$
            @SqueamishOssifrage Even though technically CLMUL isn't contained in the AES-NI, they usually appear together, so many people consider CLMUL to be part of AES-NI for all practical intents and purposes...
            $endgroup$
            – SEJPM
            Jun 4 at 16:02
















          • $begingroup$
            Surely you mean CLMUL, not AES-NI?
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:01










          • $begingroup$
            @SqueamishOssifrage Even though technically CLMUL isn't contained in the AES-NI, they usually appear together, so many people consider CLMUL to be part of AES-NI for all practical intents and purposes...
            $endgroup$
            – SEJPM
            Jun 4 at 16:02















          $begingroup$
          Surely you mean CLMUL, not AES-NI?
          $endgroup$
          – Squeamish Ossifrage
          Jun 4 at 16:01




          $begingroup$
          Surely you mean CLMUL, not AES-NI?
          $endgroup$
          – Squeamish Ossifrage
          Jun 4 at 16:01












          $begingroup$
          @SqueamishOssifrage Even though technically CLMUL isn't contained in the AES-NI, they usually appear together, so many people consider CLMUL to be part of AES-NI for all practical intents and purposes...
          $endgroup$
          – SEJPM
          Jun 4 at 16:02




          $begingroup$
          @SqueamishOssifrage Even though technically CLMUL isn't contained in the AES-NI, they usually appear together, so many people consider CLMUL to be part of AES-NI for all practical intents and purposes...
          $endgroup$
          – SEJPM
          Jun 4 at 16:02













          3












          $begingroup$

          Any polynomial evaluation hash or polynomial division hash, without length padding, has the property you seek:



          • Polynomial evauation. If $H_r(m) = m(r)$ where $m$ is a polynomial of zero constant term and degree $ell$ over some field and $r$ is an element of the field, then we have $$H_r(m) = m_1 r^ell + m_2 r^ell-1 + cdots + m_ell-1 r^2 + m_ell r,$$ so clearly $H_r(m + m') = H_r(m) + H_r(m')$. Standard examples of this form are Poly1305 and GHASH. If the field has characteristic 2, as in GHASH, then $+$ is xor. This obviously generalizes to multivariate polynomials too, e.g. the dot product $H_r_1,r_2(m_1 mathbin| m_2) = m_1 r_1 + m_2 r_2$ (which naturally attains a lower collision probability).



          • Polynomial division. If $H_f(m) = (m cdot x^n) bmod f$ where $m, f in operatornameGF(p)[x]$, and where $f$ is irreducible and of degree $n$, then clearly



            beginalign
            H_f(m + m')
            &= bigl[(m + m') cdot x^nbigr] bmod f \
            &= (m cdot x^n) bmod f + (m' cdot x^n) bmod f \
            &= H_f(m) + H_f(m').
            endalign



            Polynomial division hashes are related to CRCs and Rabin fingerprints. When $p = 2$, $+$ is xor.



          Beware that multiplication in fields of characteristic 2 is generally not efficient in software, and that the most efficient software is riddled with timing side channels—unless you can fruitfully organize your computation to simultaneously compute a batch of (say) 64 instances of it in parallel using bitslicing.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Marim specifically asked it to be homomorphic over XOR; hence you're stuck with a field with characteristic 2.
            $endgroup$
            – poncho
            Jun 4 at 15:45










          • $begingroup$
            @poncho Yes. Just wanted to make sure that Martin is aware that characteristic 2 is dangerous in software!
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 15:46











          • $begingroup$
            Actually I think that one could get say 64 parallel instances going using what poncho outlined in this older answer.
            $endgroup$
            – SEJPM
            Jun 4 at 16:04










          • $begingroup$
            @SEJPM Yes, but you need your message to be at least $8k$ bytes long to get at most a factor of $k$ improvement, and it's not a priori clear where the performance cutoff will be between a leaky table-driven implementation and a safe bitsliced implementation. My point is just that characteristic 2 can be dangerous for software because it requires you to do this analysis and tempts you into security-damaging performance tradeoffs.
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:14
















          3












          $begingroup$

          Any polynomial evaluation hash or polynomial division hash, without length padding, has the property you seek:



          • Polynomial evauation. If $H_r(m) = m(r)$ where $m$ is a polynomial of zero constant term and degree $ell$ over some field and $r$ is an element of the field, then we have $$H_r(m) = m_1 r^ell + m_2 r^ell-1 + cdots + m_ell-1 r^2 + m_ell r,$$ so clearly $H_r(m + m') = H_r(m) + H_r(m')$. Standard examples of this form are Poly1305 and GHASH. If the field has characteristic 2, as in GHASH, then $+$ is xor. This obviously generalizes to multivariate polynomials too, e.g. the dot product $H_r_1,r_2(m_1 mathbin| m_2) = m_1 r_1 + m_2 r_2$ (which naturally attains a lower collision probability).



          • Polynomial division. If $H_f(m) = (m cdot x^n) bmod f$ where $m, f in operatornameGF(p)[x]$, and where $f$ is irreducible and of degree $n$, then clearly



            beginalign
            H_f(m + m')
            &= bigl[(m + m') cdot x^nbigr] bmod f \
            &= (m cdot x^n) bmod f + (m' cdot x^n) bmod f \
            &= H_f(m) + H_f(m').
            endalign



            Polynomial division hashes are related to CRCs and Rabin fingerprints. When $p = 2$, $+$ is xor.



          Beware that multiplication in fields of characteristic 2 is generally not efficient in software, and that the most efficient software is riddled with timing side channels—unless you can fruitfully organize your computation to simultaneously compute a batch of (say) 64 instances of it in parallel using bitslicing.






          share|improve this answer











          $endgroup$












          • $begingroup$
            Marim specifically asked it to be homomorphic over XOR; hence you're stuck with a field with characteristic 2.
            $endgroup$
            – poncho
            Jun 4 at 15:45










          • $begingroup$
            @poncho Yes. Just wanted to make sure that Martin is aware that characteristic 2 is dangerous in software!
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 15:46











          • $begingroup$
            Actually I think that one could get say 64 parallel instances going using what poncho outlined in this older answer.
            $endgroup$
            – SEJPM
            Jun 4 at 16:04










          • $begingroup$
            @SEJPM Yes, but you need your message to be at least $8k$ bytes long to get at most a factor of $k$ improvement, and it's not a priori clear where the performance cutoff will be between a leaky table-driven implementation and a safe bitsliced implementation. My point is just that characteristic 2 can be dangerous for software because it requires you to do this analysis and tempts you into security-damaging performance tradeoffs.
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:14














          3












          3








          3





          $begingroup$

          Any polynomial evaluation hash or polynomial division hash, without length padding, has the property you seek:



          • Polynomial evauation. If $H_r(m) = m(r)$ where $m$ is a polynomial of zero constant term and degree $ell$ over some field and $r$ is an element of the field, then we have $$H_r(m) = m_1 r^ell + m_2 r^ell-1 + cdots + m_ell-1 r^2 + m_ell r,$$ so clearly $H_r(m + m') = H_r(m) + H_r(m')$. Standard examples of this form are Poly1305 and GHASH. If the field has characteristic 2, as in GHASH, then $+$ is xor. This obviously generalizes to multivariate polynomials too, e.g. the dot product $H_r_1,r_2(m_1 mathbin| m_2) = m_1 r_1 + m_2 r_2$ (which naturally attains a lower collision probability).



          • Polynomial division. If $H_f(m) = (m cdot x^n) bmod f$ where $m, f in operatornameGF(p)[x]$, and where $f$ is irreducible and of degree $n$, then clearly



            beginalign
            H_f(m + m')
            &= bigl[(m + m') cdot x^nbigr] bmod f \
            &= (m cdot x^n) bmod f + (m' cdot x^n) bmod f \
            &= H_f(m) + H_f(m').
            endalign



            Polynomial division hashes are related to CRCs and Rabin fingerprints. When $p = 2$, $+$ is xor.



          Beware that multiplication in fields of characteristic 2 is generally not efficient in software, and that the most efficient software is riddled with timing side channels—unless you can fruitfully organize your computation to simultaneously compute a batch of (say) 64 instances of it in parallel using bitslicing.






          share|improve this answer











          $endgroup$



          Any polynomial evaluation hash or polynomial division hash, without length padding, has the property you seek:



          • Polynomial evauation. If $H_r(m) = m(r)$ where $m$ is a polynomial of zero constant term and degree $ell$ over some field and $r$ is an element of the field, then we have $$H_r(m) = m_1 r^ell + m_2 r^ell-1 + cdots + m_ell-1 r^2 + m_ell r,$$ so clearly $H_r(m + m') = H_r(m) + H_r(m')$. Standard examples of this form are Poly1305 and GHASH. If the field has characteristic 2, as in GHASH, then $+$ is xor. This obviously generalizes to multivariate polynomials too, e.g. the dot product $H_r_1,r_2(m_1 mathbin| m_2) = m_1 r_1 + m_2 r_2$ (which naturally attains a lower collision probability).



          • Polynomial division. If $H_f(m) = (m cdot x^n) bmod f$ where $m, f in operatornameGF(p)[x]$, and where $f$ is irreducible and of degree $n$, then clearly



            beginalign
            H_f(m + m')
            &= bigl[(m + m') cdot x^nbigr] bmod f \
            &= (m cdot x^n) bmod f + (m' cdot x^n) bmod f \
            &= H_f(m) + H_f(m').
            endalign



            Polynomial division hashes are related to CRCs and Rabin fingerprints. When $p = 2$, $+$ is xor.



          Beware that multiplication in fields of characteristic 2 is generally not efficient in software, and that the most efficient software is riddled with timing side channels—unless you can fruitfully organize your computation to simultaneously compute a batch of (say) 64 instances of it in parallel using bitslicing.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jun 4 at 16:03

























          answered Jun 4 at 14:50









          Squeamish OssifrageSqueamish Ossifrage

          28.8k144122




          28.8k144122











          • $begingroup$
            Marim specifically asked it to be homomorphic over XOR; hence you're stuck with a field with characteristic 2.
            $endgroup$
            – poncho
            Jun 4 at 15:45










          • $begingroup$
            @poncho Yes. Just wanted to make sure that Martin is aware that characteristic 2 is dangerous in software!
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 15:46











          • $begingroup$
            Actually I think that one could get say 64 parallel instances going using what poncho outlined in this older answer.
            $endgroup$
            – SEJPM
            Jun 4 at 16:04










          • $begingroup$
            @SEJPM Yes, but you need your message to be at least $8k$ bytes long to get at most a factor of $k$ improvement, and it's not a priori clear where the performance cutoff will be between a leaky table-driven implementation and a safe bitsliced implementation. My point is just that characteristic 2 can be dangerous for software because it requires you to do this analysis and tempts you into security-damaging performance tradeoffs.
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:14

















          • $begingroup$
            Marim specifically asked it to be homomorphic over XOR; hence you're stuck with a field with characteristic 2.
            $endgroup$
            – poncho
            Jun 4 at 15:45










          • $begingroup$
            @poncho Yes. Just wanted to make sure that Martin is aware that characteristic 2 is dangerous in software!
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 15:46











          • $begingroup$
            Actually I think that one could get say 64 parallel instances going using what poncho outlined in this older answer.
            $endgroup$
            – SEJPM
            Jun 4 at 16:04










          • $begingroup$
            @SEJPM Yes, but you need your message to be at least $8k$ bytes long to get at most a factor of $k$ improvement, and it's not a priori clear where the performance cutoff will be between a leaky table-driven implementation and a safe bitsliced implementation. My point is just that characteristic 2 can be dangerous for software because it requires you to do this analysis and tempts you into security-damaging performance tradeoffs.
            $endgroup$
            – Squeamish Ossifrage
            Jun 4 at 16:14
















          $begingroup$
          Marim specifically asked it to be homomorphic over XOR; hence you're stuck with a field with characteristic 2.
          $endgroup$
          – poncho
          Jun 4 at 15:45




          $begingroup$
          Marim specifically asked it to be homomorphic over XOR; hence you're stuck with a field with characteristic 2.
          $endgroup$
          – poncho
          Jun 4 at 15:45












          $begingroup$
          @poncho Yes. Just wanted to make sure that Martin is aware that characteristic 2 is dangerous in software!
          $endgroup$
          – Squeamish Ossifrage
          Jun 4 at 15:46





          $begingroup$
          @poncho Yes. Just wanted to make sure that Martin is aware that characteristic 2 is dangerous in software!
          $endgroup$
          – Squeamish Ossifrage
          Jun 4 at 15:46













          $begingroup$
          Actually I think that one could get say 64 parallel instances going using what poncho outlined in this older answer.
          $endgroup$
          – SEJPM
          Jun 4 at 16:04




          $begingroup$
          Actually I think that one could get say 64 parallel instances going using what poncho outlined in this older answer.
          $endgroup$
          – SEJPM
          Jun 4 at 16:04












          $begingroup$
          @SEJPM Yes, but you need your message to be at least $8k$ bytes long to get at most a factor of $k$ improvement, and it's not a priori clear where the performance cutoff will be between a leaky table-driven implementation and a safe bitsliced implementation. My point is just that characteristic 2 can be dangerous for software because it requires you to do this analysis and tempts you into security-damaging performance tradeoffs.
          $endgroup$
          – Squeamish Ossifrage
          Jun 4 at 16:14





          $begingroup$
          @SEJPM Yes, but you need your message to be at least $8k$ bytes long to get at most a factor of $k$ improvement, and it's not a priori clear where the performance cutoff will be between a leaky table-driven implementation and a safe bitsliced implementation. My point is just that characteristic 2 can be dangerous for software because it requires you to do this analysis and tempts you into security-damaging performance tradeoffs.
          $endgroup$
          – Squeamish Ossifrage
          Jun 4 at 16:14


















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Cryptography Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcrypto.stackexchange.com%2fquestions%2f71048%2funiversal-hash-functions-with-homomorphic-xor-property%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

          Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

          What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company