How can my private key be revealed if I use the same nonce while generating the signature?How can I use message signing to prove that I have private keys for many different accounts?Step by Step - how does sending 1 bitcoin work?Can same private key generate multiple addresses?How a private key can be invalid?Multi signature wallet I'll know the private keyGenerating private/public key and using ECC and EC_POINT_mul() functionDigital Signature and private/public keyWhat does a bitcoin transaction contain?generating private key from bip39 seedHow can you calculate the inverse of S component of signature, while you cannot do it in ECC to calculate private key from public key?

Bash method for viewing beginning and end of file

Will it be accepted, if there is no ''Main Character" stereotype?

voltage of sounds of mp3files

How does a character multiclassing into warlock get a focus?

Is the destination of a commercial flight important for the pilot?

Are there any comparative studies done between Ashtavakra Gita and Buddhim?

Time travel short story where a man arrives in the late 19th century in a time machine and then sends the machine back into the past

Do I need a multiple entry visa for a trip UK -> Sweden -> UK?

Star/Wye electrical connection math symbol

Why Were Madagascar and New Zealand Discovered So Late?

Modify casing of marked letters

The plural of 'stomach"

Increase performance creating Mandelbrot set in python

Is there a good way to store credentials outside of a password manager?

Can I use my Chinese passport to enter China after I acquired another citizenship?

Using parameter substitution on a Bash array

How can I use the arrow sign in my bash prompt?

Why does John Bercow say “unlock” after reading out the results of a vote?

How can a jailer prevent the Forge Cleric's Artisan's Blessing from being used?

Minimal reference content

Should my PhD thesis be submitted under my legal name?

Is it okay / does it make sense for another player to join a running game of Munchkin?

apt-get update is failing in debian

Your magic is very sketchy



How can my private key be revealed if I use the same nonce while generating the signature?


How can I use message signing to prove that I have private keys for many different accounts?Step by Step - how does sending 1 bitcoin work?Can same private key generate multiple addresses?How a private key can be invalid?Multi signature wallet I'll know the private keyGenerating private/public key and using ECC and EC_POINT_mul() functionDigital Signature and private/public keyWhat does a bitcoin transaction contain?generating private key from bip39 seedHow can you calculate the inverse of S component of signature, while you cannot do it in ECC to calculate private key from public key?













2















I know it is well understood that it is not a good practice to use the same nonce while generating the signatures, but I am not getting the math right.



Assume I have some UTXOs that are controlled by my private key Q. Say I have spent two of the UTXOs using nonce 'N' to generate my signature. Now the (R,S) components of the signature are public and the transactions are public so everyone has access to them.



S1 = N^(-1)*[hash(m1) + Q*R] mod p


S2 = N^(-1)*[hash(m2) + Q*R] mod p



S1 - S2 = N^(-1)*[hash(m1) - hash(m2)] mod p


Even though we know S1, S2, m1 and m2, isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?










share|improve this question


























    2















    I know it is well understood that it is not a good practice to use the same nonce while generating the signatures, but I am not getting the math right.



    Assume I have some UTXOs that are controlled by my private key Q. Say I have spent two of the UTXOs using nonce 'N' to generate my signature. Now the (R,S) components of the signature are public and the transactions are public so everyone has access to them.



    S1 = N^(-1)*[hash(m1) + Q*R] mod p


    S2 = N^(-1)*[hash(m2) + Q*R] mod p



    S1 - S2 = N^(-1)*[hash(m1) - hash(m2)] mod p


    Even though we know S1, S2, m1 and m2, isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?










    share|improve this question
























      2












      2








      2








      I know it is well understood that it is not a good practice to use the same nonce while generating the signatures, but I am not getting the math right.



      Assume I have some UTXOs that are controlled by my private key Q. Say I have spent two of the UTXOs using nonce 'N' to generate my signature. Now the (R,S) components of the signature are public and the transactions are public so everyone has access to them.



      S1 = N^(-1)*[hash(m1) + Q*R] mod p


      S2 = N^(-1)*[hash(m2) + Q*R] mod p



      S1 - S2 = N^(-1)*[hash(m1) - hash(m2)] mod p


      Even though we know S1, S2, m1 and m2, isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?










      share|improve this question














      I know it is well understood that it is not a good practice to use the same nonce while generating the signatures, but I am not getting the math right.



      Assume I have some UTXOs that are controlled by my private key Q. Say I have spent two of the UTXOs using nonce 'N' to generate my signature. Now the (R,S) components of the signature are public and the transactions are public so everyone has access to them.



      S1 = N^(-1)*[hash(m1) + Q*R] mod p


      S2 = N^(-1)*[hash(m2) + Q*R] mod p



      S1 - S2 = N^(-1)*[hash(m1) - hash(m2)] mod p


      Even though we know S1, S2, m1 and m2, isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?







      private-key signature cryptography






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 7 hours ago









      Ugam KamatUgam Kamat

      42112




      42112




















          2 Answers
          2






          active

          oldest

          votes


















          1















          isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?




          No, it is not. This does not require finding the discrete logarithm at all. Solving the discrete logarithm is finding the exponent to a known base. However in this problem we are trying to find the base and know what the exponent is. Furthermore, this known exponent is -1 for which finding the base of something raise to -1 is to raise the result to -1 again, i.e. taking the inverse of the inverse.



          There are algorithms that exist to find the modular inverse of a number which is how N^(-1) is found in the first place. To find N, you just need to take the inverse of N^(-1) because of the identity that an inverse an inverse is the element itself.






          share|improve this answer























          • Isn't the order of how the equation is written same as the public key generation? You have [hash(m1) - hash(m2)] as the base and N^(-1) as the exponent?

            – Ugam Kamat
            5 hours ago






          • 1





            No. [hash(m1) - hash(m2)] is an integer, not a elliptic curve point. N^(-1) is also an integer. So this formula is just integer multiplication. It is not exponentiation nor is it curve point multiplication (the two things that have discrete log problems). Thus it is not solving any discrete logarithm.

            – Andrew Chow
            5 hours ago











          • That's what I was looking for. So since N^(-1)*[hash(m1) - hash(m2)] is just integer multiplication modulo p vs curve point addition.

            – Ugam Kamat
            4 hours ago


















          2














          Let me rewrite your question in a different notation, where all lowercase values are integers and uppercase values are points.



          • The group generator is G (a known constant).

          • The private key is q, its corresponding public key is Q = qG.

          • The nonce is n, its corresponding point is R = nG.

          • The X coordinate of R is r.

          • The hash function is h(x).

          • A signature is (r,s), where s is computed as n-1(h(m) + qr).

          • A signature is valid iff r = x(s-1(h(m)G + rQ)).

          Now for the two signatures it holds that:



          • s1 = n-1(h(m1) + qr)

          • s2 = n-1(h(m2) + qr)

          • s1 - s2 = n-1(h(m1) - h(m2))

          • n = (s1 - s2)-1(h(m1) - h(m2))

          As s1 and s2 are just integers, (s1 - s2)-1 can be trivially computed using a modular inverse; there are no elliptic curve points involved here (over which this problem would be hard).



          Once you know n, you can find q by rewriting the first equation:



          • ns1 = h(m1) + qr

          • ns1 - h(m1) = qr

          • q = r-1(ns1 - h(m1))





          share|improve this answer
























            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "308"
            ;
            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%2fbitcoin.stackexchange.com%2fquestions%2f85638%2fhow-can-my-private-key-be-revealed-if-i-use-the-same-nonce-while-generating-the%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









            1















            isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?




            No, it is not. This does not require finding the discrete logarithm at all. Solving the discrete logarithm is finding the exponent to a known base. However in this problem we are trying to find the base and know what the exponent is. Furthermore, this known exponent is -1 for which finding the base of something raise to -1 is to raise the result to -1 again, i.e. taking the inverse of the inverse.



            There are algorithms that exist to find the modular inverse of a number which is how N^(-1) is found in the first place. To find N, you just need to take the inverse of N^(-1) because of the identity that an inverse an inverse is the element itself.






            share|improve this answer























            • Isn't the order of how the equation is written same as the public key generation? You have [hash(m1) - hash(m2)] as the base and N^(-1) as the exponent?

              – Ugam Kamat
              5 hours ago






            • 1





              No. [hash(m1) - hash(m2)] is an integer, not a elliptic curve point. N^(-1) is also an integer. So this formula is just integer multiplication. It is not exponentiation nor is it curve point multiplication (the two things that have discrete log problems). Thus it is not solving any discrete logarithm.

              – Andrew Chow
              5 hours ago











            • That's what I was looking for. So since N^(-1)*[hash(m1) - hash(m2)] is just integer multiplication modulo p vs curve point addition.

              – Ugam Kamat
              4 hours ago















            1















            isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?




            No, it is not. This does not require finding the discrete logarithm at all. Solving the discrete logarithm is finding the exponent to a known base. However in this problem we are trying to find the base and know what the exponent is. Furthermore, this known exponent is -1 for which finding the base of something raise to -1 is to raise the result to -1 again, i.e. taking the inverse of the inverse.



            There are algorithms that exist to find the modular inverse of a number which is how N^(-1) is found in the first place. To find N, you just need to take the inverse of N^(-1) because of the identity that an inverse an inverse is the element itself.






            share|improve this answer























            • Isn't the order of how the equation is written same as the public key generation? You have [hash(m1) - hash(m2)] as the base and N^(-1) as the exponent?

              – Ugam Kamat
              5 hours ago






            • 1





              No. [hash(m1) - hash(m2)] is an integer, not a elliptic curve point. N^(-1) is also an integer. So this formula is just integer multiplication. It is not exponentiation nor is it curve point multiplication (the two things that have discrete log problems). Thus it is not solving any discrete logarithm.

              – Andrew Chow
              5 hours ago











            • That's what I was looking for. So since N^(-1)*[hash(m1) - hash(m2)] is just integer multiplication modulo p vs curve point addition.

              – Ugam Kamat
              4 hours ago













            1












            1








            1








            isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?




            No, it is not. This does not require finding the discrete logarithm at all. Solving the discrete logarithm is finding the exponent to a known base. However in this problem we are trying to find the base and know what the exponent is. Furthermore, this known exponent is -1 for which finding the base of something raise to -1 is to raise the result to -1 again, i.e. taking the inverse of the inverse.



            There are algorithms that exist to find the modular inverse of a number which is how N^(-1) is found in the first place. To find N, you just need to take the inverse of N^(-1) because of the identity that an inverse an inverse is the element itself.






            share|improve this answer














            isn't solving for N^(-1), and hence N, becomes equivalent to finding the solution to the discrete logarithm?




            No, it is not. This does not require finding the discrete logarithm at all. Solving the discrete logarithm is finding the exponent to a known base. However in this problem we are trying to find the base and know what the exponent is. Furthermore, this known exponent is -1 for which finding the base of something raise to -1 is to raise the result to -1 again, i.e. taking the inverse of the inverse.



            There are algorithms that exist to find the modular inverse of a number which is how N^(-1) is found in the first place. To find N, you just need to take the inverse of N^(-1) because of the identity that an inverse an inverse is the element itself.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 5 hours ago









            Andrew ChowAndrew Chow

            33k42462




            33k42462












            • Isn't the order of how the equation is written same as the public key generation? You have [hash(m1) - hash(m2)] as the base and N^(-1) as the exponent?

              – Ugam Kamat
              5 hours ago






            • 1





              No. [hash(m1) - hash(m2)] is an integer, not a elliptic curve point. N^(-1) is also an integer. So this formula is just integer multiplication. It is not exponentiation nor is it curve point multiplication (the two things that have discrete log problems). Thus it is not solving any discrete logarithm.

              – Andrew Chow
              5 hours ago











            • That's what I was looking for. So since N^(-1)*[hash(m1) - hash(m2)] is just integer multiplication modulo p vs curve point addition.

              – Ugam Kamat
              4 hours ago

















            • Isn't the order of how the equation is written same as the public key generation? You have [hash(m1) - hash(m2)] as the base and N^(-1) as the exponent?

              – Ugam Kamat
              5 hours ago






            • 1





              No. [hash(m1) - hash(m2)] is an integer, not a elliptic curve point. N^(-1) is also an integer. So this formula is just integer multiplication. It is not exponentiation nor is it curve point multiplication (the two things that have discrete log problems). Thus it is not solving any discrete logarithm.

              – Andrew Chow
              5 hours ago











            • That's what I was looking for. So since N^(-1)*[hash(m1) - hash(m2)] is just integer multiplication modulo p vs curve point addition.

              – Ugam Kamat
              4 hours ago
















            Isn't the order of how the equation is written same as the public key generation? You have [hash(m1) - hash(m2)] as the base and N^(-1) as the exponent?

            – Ugam Kamat
            5 hours ago





            Isn't the order of how the equation is written same as the public key generation? You have [hash(m1) - hash(m2)] as the base and N^(-1) as the exponent?

            – Ugam Kamat
            5 hours ago




            1




            1





            No. [hash(m1) - hash(m2)] is an integer, not a elliptic curve point. N^(-1) is also an integer. So this formula is just integer multiplication. It is not exponentiation nor is it curve point multiplication (the two things that have discrete log problems). Thus it is not solving any discrete logarithm.

            – Andrew Chow
            5 hours ago





            No. [hash(m1) - hash(m2)] is an integer, not a elliptic curve point. N^(-1) is also an integer. So this formula is just integer multiplication. It is not exponentiation nor is it curve point multiplication (the two things that have discrete log problems). Thus it is not solving any discrete logarithm.

            – Andrew Chow
            5 hours ago













            That's what I was looking for. So since N^(-1)*[hash(m1) - hash(m2)] is just integer multiplication modulo p vs curve point addition.

            – Ugam Kamat
            4 hours ago





            That's what I was looking for. So since N^(-1)*[hash(m1) - hash(m2)] is just integer multiplication modulo p vs curve point addition.

            – Ugam Kamat
            4 hours ago











            2














            Let me rewrite your question in a different notation, where all lowercase values are integers and uppercase values are points.



            • The group generator is G (a known constant).

            • The private key is q, its corresponding public key is Q = qG.

            • The nonce is n, its corresponding point is R = nG.

            • The X coordinate of R is r.

            • The hash function is h(x).

            • A signature is (r,s), where s is computed as n-1(h(m) + qr).

            • A signature is valid iff r = x(s-1(h(m)G + rQ)).

            Now for the two signatures it holds that:



            • s1 = n-1(h(m1) + qr)

            • s2 = n-1(h(m2) + qr)

            • s1 - s2 = n-1(h(m1) - h(m2))

            • n = (s1 - s2)-1(h(m1) - h(m2))

            As s1 and s2 are just integers, (s1 - s2)-1 can be trivially computed using a modular inverse; there are no elliptic curve points involved here (over which this problem would be hard).



            Once you know n, you can find q by rewriting the first equation:



            • ns1 = h(m1) + qr

            • ns1 - h(m1) = qr

            • q = r-1(ns1 - h(m1))





            share|improve this answer





























              2














              Let me rewrite your question in a different notation, where all lowercase values are integers and uppercase values are points.



              • The group generator is G (a known constant).

              • The private key is q, its corresponding public key is Q = qG.

              • The nonce is n, its corresponding point is R = nG.

              • The X coordinate of R is r.

              • The hash function is h(x).

              • A signature is (r,s), where s is computed as n-1(h(m) + qr).

              • A signature is valid iff r = x(s-1(h(m)G + rQ)).

              Now for the two signatures it holds that:



              • s1 = n-1(h(m1) + qr)

              • s2 = n-1(h(m2) + qr)

              • s1 - s2 = n-1(h(m1) - h(m2))

              • n = (s1 - s2)-1(h(m1) - h(m2))

              As s1 and s2 are just integers, (s1 - s2)-1 can be trivially computed using a modular inverse; there are no elliptic curve points involved here (over which this problem would be hard).



              Once you know n, you can find q by rewriting the first equation:



              • ns1 = h(m1) + qr

              • ns1 - h(m1) = qr

              • q = r-1(ns1 - h(m1))





              share|improve this answer



























                2












                2








                2







                Let me rewrite your question in a different notation, where all lowercase values are integers and uppercase values are points.



                • The group generator is G (a known constant).

                • The private key is q, its corresponding public key is Q = qG.

                • The nonce is n, its corresponding point is R = nG.

                • The X coordinate of R is r.

                • The hash function is h(x).

                • A signature is (r,s), where s is computed as n-1(h(m) + qr).

                • A signature is valid iff r = x(s-1(h(m)G + rQ)).

                Now for the two signatures it holds that:



                • s1 = n-1(h(m1) + qr)

                • s2 = n-1(h(m2) + qr)

                • s1 - s2 = n-1(h(m1) - h(m2))

                • n = (s1 - s2)-1(h(m1) - h(m2))

                As s1 and s2 are just integers, (s1 - s2)-1 can be trivially computed using a modular inverse; there are no elliptic curve points involved here (over which this problem would be hard).



                Once you know n, you can find q by rewriting the first equation:



                • ns1 = h(m1) + qr

                • ns1 - h(m1) = qr

                • q = r-1(ns1 - h(m1))





                share|improve this answer















                Let me rewrite your question in a different notation, where all lowercase values are integers and uppercase values are points.



                • The group generator is G (a known constant).

                • The private key is q, its corresponding public key is Q = qG.

                • The nonce is n, its corresponding point is R = nG.

                • The X coordinate of R is r.

                • The hash function is h(x).

                • A signature is (r,s), where s is computed as n-1(h(m) + qr).

                • A signature is valid iff r = x(s-1(h(m)G + rQ)).

                Now for the two signatures it holds that:



                • s1 = n-1(h(m1) + qr)

                • s2 = n-1(h(m2) + qr)

                • s1 - s2 = n-1(h(m1) - h(m2))

                • n = (s1 - s2)-1(h(m1) - h(m2))

                As s1 and s2 are just integers, (s1 - s2)-1 can be trivially computed using a modular inverse; there are no elliptic curve points involved here (over which this problem would be hard).



                Once you know n, you can find q by rewriting the first equation:



                • ns1 = h(m1) + qr

                • ns1 - h(m1) = qr

                • q = r-1(ns1 - h(m1))






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 4 hours ago

























                answered 5 hours ago









                Pieter WuillePieter Wuille

                47.7k399160




                47.7k399160



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Bitcoin 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.

                    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%2fbitcoin.stackexchange.com%2fquestions%2f85638%2fhow-can-my-private-key-be-revealed-if-i-use-the-same-nonce-while-generating-the%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 create a command for the “strange m” symbol in latex? Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)How do you make your own symbol when Detexify fails?Writing bold small caps with mathpazo packageplus-minus symbol with parenthesis around the minus signGreek character in Beamer document titleHow to create dashed right arrow over symbol?Currency symbol: Turkish LiraDouble prec as a single symbol?Plus Sign Too Big; How to Call adfbullet?Is there a TeX macro for three-legged pi?How do I get my integral-like symbol to align like the integral?How to selectively substitute a letter with another symbol representing the same letterHow do I generate a less than symbol and vertical bar that are the same height?

                    Българска екзархия Съдържание История | Български екзарси | Вижте също | Външни препратки | Литература | Бележки | НавигацияУстав за управлението на българската екзархия. Цариград, 1870Слово на Ловешкия митрополит Иларион при откриването на Българския народен събор в Цариград на 23. II. 1870 г.Българската правда и гръцката кривда. От С. М. (= Софийски Мелетий). Цариград, 1872Предстоятели на Българската екзархияПодмененият ВеликденИнформационна агенция „Фокус“Димитър Ризов. Българите в техните исторически, етнографически и политически граници (Атлас съдържащ 40 карти). Berlin, Königliche Hoflithographie, Hof-Buch- und -Steindruckerei Wilhelm Greve, 1917Report of the International Commission to Inquire into the Causes and Conduct of the Balkan Wars

                    Чепеларе Съдържание География | История | Население | Спортни и природни забележителности | Културни и исторически обекти | Религии | Обществени институции | Известни личности | Редовни събития | Галерия | Източници | Литература | Външни препратки | Навигация41°43′23.99″ с. ш. 24°41′09.99″ и. д. / 41.723333° с. ш. 24.686111° и. д.*ЧепелареЧепеларски Linux fest 2002Начало на Зимен сезон 2005/06Национални хайдушки празници „Капитан Петко Войвода“Град ЧепелареЧепеларе – народният ски курортbgrod.orgwww.terranatura.hit.bgСправка за населението на гр. Исперих, общ. Исперих, обл. РазградМузей на родопския карстМузей на спорта и скитеЧепеларебългарскибългарскианглийскитукИстория на градаСки писти в ЧепелареВремето в ЧепелареРадио и телевизия в ЧепелареЧепеларе мами с родопски чар и добри пистиЕвтин туризъм и снежни атракции в ЧепелареМестоположениеИнформация и снимки от музея на родопския карст3D панорами от ЧепелареЧепелареррр