MD5 Round Operations RFC1321












-1















According to this documentation of md5 function the Step 4 involves rounds of functions where




Let [abcd k s i] denote the operation



a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s).



Do the following 16 operations.




I am unsure what the "+" symbolises in this operation, be it addition or bitwise AND. Earlier in the paper it states




Let the symbol "+" denote addition of words (i.e., modulo-2^32
addition). Let X <<< s denote the 32-bit value obtained by circularly
shifting (rotating) X left by s bit positions.




I know that [abcd] are 32 bit 'Words' and T[i] is a float (ive converted into 32 bit word and X[k] is a single bit. By doing this function with bitwise AND the result at the end of the function is always a 32 bitstring of FALSE which leads me to think somewhere is going wrong.



This is the python code responsible:



    # parse to bitarrays
xb = bitarray(str(x))
tb = bitarray(str(t))

value = b & ((a & F(b,c,d) & xb & tb)) # value always turns false
value = leftshift(value, s)
return value


And a screenshot of variables watch that may be useful.
enter image description here



Thanks in advance SO community










share|improve this question


















  • 2





    Since the document itself defines + as modulo-2^32 addition I think it is safe to assume that + does not mean bitwise AND, but rather that you add the leftmost 31 bits of the two words together and discard any resulting overflow.

    – BoarGules
    Jan 2 at 15:07











  • @BoarGules: leftmost 32 bits.

    – James K Polk
    Jan 2 at 22:09











  • I don't understand where the confusion lies. "+" means addition, not bitwise "and". X[k] is not a single bit, it is a 32-bit value. You really need to re-read the RFC.

    – James K Polk
    Jan 2 at 22:12













  • @JamesKPolk Quite correct. A careless error on my part.

    – BoarGules
    Jan 3 at 8:30


















-1















According to this documentation of md5 function the Step 4 involves rounds of functions where




Let [abcd k s i] denote the operation



a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s).



Do the following 16 operations.




I am unsure what the "+" symbolises in this operation, be it addition or bitwise AND. Earlier in the paper it states




Let the symbol "+" denote addition of words (i.e., modulo-2^32
addition). Let X <<< s denote the 32-bit value obtained by circularly
shifting (rotating) X left by s bit positions.




I know that [abcd] are 32 bit 'Words' and T[i] is a float (ive converted into 32 bit word and X[k] is a single bit. By doing this function with bitwise AND the result at the end of the function is always a 32 bitstring of FALSE which leads me to think somewhere is going wrong.



This is the python code responsible:



    # parse to bitarrays
xb = bitarray(str(x))
tb = bitarray(str(t))

value = b & ((a & F(b,c,d) & xb & tb)) # value always turns false
value = leftshift(value, s)
return value


And a screenshot of variables watch that may be useful.
enter image description here



Thanks in advance SO community










share|improve this question


















  • 2





    Since the document itself defines + as modulo-2^32 addition I think it is safe to assume that + does not mean bitwise AND, but rather that you add the leftmost 31 bits of the two words together and discard any resulting overflow.

    – BoarGules
    Jan 2 at 15:07











  • @BoarGules: leftmost 32 bits.

    – James K Polk
    Jan 2 at 22:09











  • I don't understand where the confusion lies. "+" means addition, not bitwise "and". X[k] is not a single bit, it is a 32-bit value. You really need to re-read the RFC.

    – James K Polk
    Jan 2 at 22:12













  • @JamesKPolk Quite correct. A careless error on my part.

    – BoarGules
    Jan 3 at 8:30
















-1












-1








-1








According to this documentation of md5 function the Step 4 involves rounds of functions where




Let [abcd k s i] denote the operation



a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s).



Do the following 16 operations.




I am unsure what the "+" symbolises in this operation, be it addition or bitwise AND. Earlier in the paper it states




Let the symbol "+" denote addition of words (i.e., modulo-2^32
addition). Let X <<< s denote the 32-bit value obtained by circularly
shifting (rotating) X left by s bit positions.




I know that [abcd] are 32 bit 'Words' and T[i] is a float (ive converted into 32 bit word and X[k] is a single bit. By doing this function with bitwise AND the result at the end of the function is always a 32 bitstring of FALSE which leads me to think somewhere is going wrong.



This is the python code responsible:



    # parse to bitarrays
xb = bitarray(str(x))
tb = bitarray(str(t))

value = b & ((a & F(b,c,d) & xb & tb)) # value always turns false
value = leftshift(value, s)
return value


And a screenshot of variables watch that may be useful.
enter image description here



Thanks in advance SO community










share|improve this question














According to this documentation of md5 function the Step 4 involves rounds of functions where




Let [abcd k s i] denote the operation



a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s).



Do the following 16 operations.




I am unsure what the "+" symbolises in this operation, be it addition or bitwise AND. Earlier in the paper it states




Let the symbol "+" denote addition of words (i.e., modulo-2^32
addition). Let X <<< s denote the 32-bit value obtained by circularly
shifting (rotating) X left by s bit positions.




I know that [abcd] are 32 bit 'Words' and T[i] is a float (ive converted into 32 bit word and X[k] is a single bit. By doing this function with bitwise AND the result at the end of the function is always a 32 bitstring of FALSE which leads me to think somewhere is going wrong.



This is the python code responsible:



    # parse to bitarrays
xb = bitarray(str(x))
tb = bitarray(str(t))

value = b & ((a & F(b,c,d) & xb & tb)) # value always turns false
value = leftshift(value, s)
return value


And a screenshot of variables watch that may be useful.
enter image description here



Thanks in advance SO community







python cryptography md5






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 14:49









euan joneseuan jones

336




336








  • 2





    Since the document itself defines + as modulo-2^32 addition I think it is safe to assume that + does not mean bitwise AND, but rather that you add the leftmost 31 bits of the two words together and discard any resulting overflow.

    – BoarGules
    Jan 2 at 15:07











  • @BoarGules: leftmost 32 bits.

    – James K Polk
    Jan 2 at 22:09











  • I don't understand where the confusion lies. "+" means addition, not bitwise "and". X[k] is not a single bit, it is a 32-bit value. You really need to re-read the RFC.

    – James K Polk
    Jan 2 at 22:12













  • @JamesKPolk Quite correct. A careless error on my part.

    – BoarGules
    Jan 3 at 8:30
















  • 2





    Since the document itself defines + as modulo-2^32 addition I think it is safe to assume that + does not mean bitwise AND, but rather that you add the leftmost 31 bits of the two words together and discard any resulting overflow.

    – BoarGules
    Jan 2 at 15:07











  • @BoarGules: leftmost 32 bits.

    – James K Polk
    Jan 2 at 22:09











  • I don't understand where the confusion lies. "+" means addition, not bitwise "and". X[k] is not a single bit, it is a 32-bit value. You really need to re-read the RFC.

    – James K Polk
    Jan 2 at 22:12













  • @JamesKPolk Quite correct. A careless error on my part.

    – BoarGules
    Jan 3 at 8:30










2




2





Since the document itself defines + as modulo-2^32 addition I think it is safe to assume that + does not mean bitwise AND, but rather that you add the leftmost 31 bits of the two words together and discard any resulting overflow.

– BoarGules
Jan 2 at 15:07





Since the document itself defines + as modulo-2^32 addition I think it is safe to assume that + does not mean bitwise AND, but rather that you add the leftmost 31 bits of the two words together and discard any resulting overflow.

– BoarGules
Jan 2 at 15:07













@BoarGules: leftmost 32 bits.

– James K Polk
Jan 2 at 22:09





@BoarGules: leftmost 32 bits.

– James K Polk
Jan 2 at 22:09













I don't understand where the confusion lies. "+" means addition, not bitwise "and". X[k] is not a single bit, it is a 32-bit value. You really need to re-read the RFC.

– James K Polk
Jan 2 at 22:12







I don't understand where the confusion lies. "+" means addition, not bitwise "and". X[k] is not a single bit, it is a 32-bit value. You really need to re-read the RFC.

– James K Polk
Jan 2 at 22:12















@JamesKPolk Quite correct. A careless error on my part.

– BoarGules
Jan 3 at 8:30







@JamesKPolk Quite correct. A careless error on my part.

– BoarGules
Jan 3 at 8:30














1 Answer
1






active

oldest

votes


















0














When the specification says + means 32 bit addition implement + using 32 bit addition instead of bitwise and.



When in doubt you can see other MD5 implementations.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    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: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    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
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54008395%2fmd5-round-operations-rfc1321%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    When the specification says + means 32 bit addition implement + using 32 bit addition instead of bitwise and.



    When in doubt you can see other MD5 implementations.






    share|improve this answer




























      0














      When the specification says + means 32 bit addition implement + using 32 bit addition instead of bitwise and.



      When in doubt you can see other MD5 implementations.






      share|improve this answer


























        0












        0








        0







        When the specification says + means 32 bit addition implement + using 32 bit addition instead of bitwise and.



        When in doubt you can see other MD5 implementations.






        share|improve this answer













        When the specification says + means 32 bit addition implement + using 32 bit addition instead of bitwise and.



        When in doubt you can see other MD5 implementations.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 2 at 16:55









        Thomas M. DuBuissonThomas M. DuBuisson

        55.9k690153




        55.9k690153
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • 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%2fstackoverflow.com%2fquestions%2f54008395%2fmd5-round-operations-rfc1321%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

            Monofisismo

            Angular Downloading a file using contenturl with Basic Authentication

            Olmecas