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

          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

          Esgonzo ibérico Índice Descrición Distribución Hábitat Ameazas Notas Véxase tamén "Acerca dos nomes dos anfibios e réptiles galegos""Chalcides bedriagai"Chalcides bedriagai en Carrascal, L. M. Salvador, A. (Eds). Enciclopedia virtual de los vertebrados españoles. Museo Nacional de Ciencias Naturales, Madrid. España.Fotos