[Cuis-dev] Hello and MD5 hash weird behavior

Jeroen Kouwer jeroen.kouwer at gmail.com
Sat Nov 8 14:52:58 PST 2025


Hello,

I'm new to this list and new to Smalltalk development. I'm a software 
engineer by profession and grew up with Unix (SVR4), Pascal and C. Since 
then I've moved to Linux, Java and C++ and although I've read about 
Smaltalk and I have been intrigued with the idea behind it, I've never 
actually programmed in it.

Until now.

I've started The Cuis Book, together with the SBE and the Cuis Cook 
Book, and am currently trying to solve the first year of the Advent of 
Code (2015) in Smalltalk (the Cuis version [1]). The first three days 
went really well. The challenge came on day four: having to use MD5 hash 
calculation. Cuis, out of the box, doesn't come with an MD5 class. A 
little searching led me to the Cryptography package [2] and I installed 
the package using the File List.

Side note: This package does not define a feature, so when next starting 
the image (provided having saved it) it throws you into the debugger. 
The package is recognized, but when checking for new versions it finds 
out that there's no feature defined (nil is not a valid feature) and 
this part of opening the image cannot handle that:
```
UndefinedObject(Object)>>doesNotUnderstand: #isLaterThan:
[] in ChangeSet class>>installNewUpdates:
...
```
However, this can be solved by saving the package (open Installed 
Packeges); saving the package apparently adds the category as feature to 
the *.pck.st.

Back to Cryptography and feature Cuis-System-Hashing (from the 
Cryptography package [2]): I cannot get the MD5 class to behave as I 
expect it to behave. I expect that each call to hashMessage with the 
same message results in the same hash, which it does in Squeak and Pharo 
(after some frustration I did some checking).

After having loaded the package for the first time and executing it the 
results are as expected:
```
((MD5 new) hashMessage: 'abcdef609043') hex.
  '000001DBBFA3A5C83A2D506429C7B00E' .
```
Executing it a second time results in:
```
((MD5 new) hashMessage: 'abcdef609043') hex.
  'D1CE4AB38D6D9DC0E1FF789725EFA294' .
```
Each consecutive execution results in a different value, which is not 
what I expected!

(I've managed to solve day four by resorting to Squeak :o, sorry...)

Does anyone has an idea why this calculation keeps on producing new 
values on each execution?

Regards,
Jeroen Kouwer

P.S. I have observed the same behavior with Cuis 7.2 [3]


[1] https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev

[2] https://github.com/garduino/Cuis-Smalltalk-Cryptography

[3] https://github.com/Cuis-Smalltalk/Cuis7-2



More information about the Cuis-dev mailing list