<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hallo Luciano,</p>
    <p>Thanks for looking into this issue, and thanks for the hint to
      change the #doWithIndex: to #withIndexDo: when using the
      MD5NonPrimitive! Also, it took me some time to find out that there
      appears to be an MD5Plugin that is doing the main work in the
      default situation.</p>
    <p>Looking at the current Squeak I notices an MD5WithPrimitive and
      some additional initialization calls. I've copied these deltas to
      the code offered for Cuis and now it works as expected!</p>
    <p>Yeah!</p>
    <p>I've made a pull request with these changes on the
      Cuis-Smalltalk-Cryptograpy repository [1]. However, I noticed that
      garduino hasn't been active on github lately, so my hope is not
      very high for the pull request to get accepted. We'll see.</p>
    <p>The changes can be viewed in the - at the time of writing only -
      pull request of [1], or you can fork my fork [2] of [1] and
      checkout the fix/md5-with-primitive branch.</p>
    <p>Regards,<br>
      Jeroen</p>
    <p>[1] <a class="moz-txt-link-freetext" href="https://github.com/garduino/Cuis-Smalltalk-Cryptography">https://github.com/garduino/Cuis-Smalltalk-Cryptography</a></p>
    <p>[2]
<a class="moz-txt-link-freetext" href="https://github.com/jermus67/Cuis-Smalltalk-Cryptography/tree/fix/md5-with-primitive">https://github.com/jermus67/Cuis-Smalltalk-Cryptography/tree/fix/md5-with-primitive</a></p>
    <div class="moz-cite-prefix">On 11/9/25 3:08 PM, Luciano
      Notarfrancesco via Cuis-dev wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAL5GDypjq8B42+sStsJE9pLQH5SWDs8SgQ8_6+nGkUdSXbew2w@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="auto">Hi Jeroen,</div>
      <div dir="auto">I just tried it on mac with the latest Cuis and I
        get the same results as you. However, using MD5NonPrimitive
        instead of MD5 I get the correct result (note that you will get
        a message not understood exception, because it sends the message
        #doWithIndex: that doesn’t exist, you just need to replace it
        with #withIndexDo:).</div>
      <div dir="auto"><br>
      </div>
      <div><br>
        <div class="gmail_quote gmail_quote_container">
          <div dir="ltr" class="gmail_attr">On Sun, Nov 9, 2025 at 05:53
            Jeroen Kouwer via Cuis-dev <<a
              href="mailto:cuis-dev@lists.cuis.st"
              moz-do-not-send="true" class="moz-txt-link-freetext">cuis-dev@lists.cuis.st</a>>
            wrote:<br>
          </div>
          <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;padding-left:1ex;border-left-color:rgb(204,204,204)">Hello,<br>
            <br>
            I'm new to this list and new to Smalltalk development. I'm a
            software <br>
            engineer by profession and grew up with Unix (SVR4), Pascal
            and C. Since <br>
            then I've moved to Linux, Java and C++ and although I've
            read about <br>
            Smaltalk and I have been intrigued with the idea behind it,
            I've never <br>
            actually programmed in it.<br>
            <br>
            Until now.<br>
            <br>
            I've started The Cuis Book, together with the SBE and the
            Cuis Cook <br>
            Book, and am currently trying to solve the first year of the
            Advent of <br>
            Code (2015) in Smalltalk (the Cuis version [1]). The first
            three days <br>
            went really well. The challenge came on day four: having to
            use MD5 hash <br>
            calculation. Cuis, out of the box, doesn't come with an MD5
            class. A <br>
            little searching led me to the Cryptography package [2] and
            I installed <br>
            the package using the File List.<br>
            <br>
            Side note: This package does not define a feature, so when
            next starting <br>
            the image (provided having saved it) it throws you into the
            debugger. <br>
            The package is recognized, but when checking for new
            versions it finds <br>
            out that there's no feature defined (nil is not a valid
            feature) and <br>
            this part of opening the image cannot handle that:<br>
            ```<br>
            UndefinedObject(Object)>>doesNotUnderstand:
            #isLaterThan:<br>
            [] in ChangeSet class>>installNewUpdates:<br>
            ...<br>
            ```<br>
            However, this can be solved by saving the package (open
            Installed <br>
            Packeges); saving the package apparently adds the category
            as feature to <br>
            the *.<a href="http://pck.st" rel="noreferrer"
              target="_blank" moz-do-not-send="true">pck.st</a>.<br>
            <br>
            Back to Cryptography and feature Cuis-System-Hashing (from
            the <br>
            Cryptography package [2]): I cannot get the MD5 class to
            behave as I <br>
            expect it to behave. I expect that each call to hashMessage
            with the <br>
            same message results in the same hash, which it does in
            Squeak and Pharo <br>
            (after some frustration I did some checking).<br>
            <br>
            After having loaded the package for the first time and
            executing it the <br>
            results are as expected:<br>
            ```<br>
            ((MD5 new) hashMessage: 'abcdef609043') hex.<br>
              '000001DBBFA3A5C83A2D506429C7B00E' .<br>
            ```<br>
            Executing it a second time results in:<br>
            ```<br>
            ((MD5 new) hashMessage: 'abcdef609043') hex.<br>
              'D1CE4AB38D6D9DC0E1FF789725EFA294' .<br>
            ```<br>
            Each consecutive execution results in a different value,
            which is not <br>
            what I expected!<br>
            <br>
            (I've managed to solve day four by resorting to Squeak :o,
            sorry...)<br>
            <br>
            Does anyone has an idea why this calculation keeps on
            producing new <br>
            values on each execution?<br>
            <br>
            Regards,<br>
            Jeroen Kouwer<br>
            <br>
            P.S. I have observed the same behavior with Cuis 7.2 [3]<br>
            <br>
            <br>
            [1] <a
href="https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev"
              rel="noreferrer" target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev</a><br>
            <br>
            [2] <a
href="https://github.com/garduino/Cuis-Smalltalk-Cryptography"
              rel="noreferrer" target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">https://github.com/garduino/Cuis-Smalltalk-Cryptography</a><br>
            <br>
            [3] <a href="https://github.com/Cuis-Smalltalk/Cuis7-2"
              rel="noreferrer" target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">https://github.com/Cuis-Smalltalk/Cuis7-2</a><br>
            <br>
            -- <br>
            Cuis-dev mailing list<br>
            <a href="mailto:Cuis-dev@lists.cuis.st" target="_blank"
              moz-do-not-send="true" class="moz-txt-link-freetext">Cuis-dev@lists.cuis.st</a><br>
            <a href="https://lists.cuis.st/mailman/listinfo/cuis-dev"
              rel="noreferrer" target="_blank" moz-do-not-send="true"
              class="moz-txt-link-freetext">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
          </blockquote>
        </div>
      </div>
      <br>
      <fieldset class="moz-mime-attachment-header"></fieldset>
    </blockquote>
  </body>
</html>