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

          Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

          Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

          Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020