<div>Hub Levente,</div><div><br></div><div>I like the idea of SHA256 and friends to throw an exception when #new is called directly </div><div>    SHA256 new.</div><div>With a message to call newSHA256.</div><div><br></div><div>What do you think?<caret></caret></div><div><br></div><div id="protonmail_signature_block" class="protonmail_signature_block"><div><div>Kindly,<br>Robert<br></div></div></div>  <div><br></div><div><br></div>On Tue, Jul 21, 2020 at 14:02, Levente Uzonyi <<a href="mailto:leves@caesar.elte.hu" class="">leves@caesar.elte.hu</a>> wrote:<blockquote class="protonmail_quote" type="cite">  Hi Chris,<br><br>On Mon, 20 Jul 2020, Chris Muller wrote:<br><br>> Hi Levente,<br>><br>> > >    HashFunction newSHA256<br>> > ><br>> > > instead of<br>> > ><br>> > >    SHA256 new<br>> > ><br>> > > in order to take advantage of Levente's plugin.<br>> ><br>> > That is indeed some sort of a change but it only affects those who<br>> > compiled the SHA256Plugin themselves since that plugin wasn't shipped with<br>> > the VM.<br>><br>> Ah, you're speaking about legacy code.  I really hope we can include your plugin in future VM's.  Are Eliot, et al, on board?<br><br>The most recent VMs ship with the plugins.<br><br>> > I decided against the practice of making #new return an instance of<br>> > another class than the receiver, as it was with the previous<br>> > implementation, because that makes it a lot harder for others to<br>> > understand the code.<br>><br>> Hm.  I sort of agree, although I guess Factory is a recognized pattern.  To me, the issue is that writing<br>><br>>       "SHA256 new"<br>><br>> , is a perfectly intuitive and obvious way to use it, but sticking out like a sore thumb as a subversively-wrong-way to-use-it.  It'd be better if it threw an error, and even better than that if it just worked.<br>><br>> I know you care about the quantity of methods in the image (as do I), how about quality?  Can SHA256 #new be improved by doing essentially what HashFunction #newSHA256 does, and simply sending some alternative to new (i.e.,<br><br>It's not clear what do you mean by caring about the quantity of methods.<br><br>> basicNew initialize) to avoid the recursion?<br><br>That would do exactly what I do not want to do: #new would return an<br>object whose class is not SHA256.<br><br>><br>> Above, you mentioned you decided against the practice, does that mean you're writing:<br>><br>>      SHA256 newSHA256<br>><br>> ?  If not, how did you do it?<br><br>Use HashFunction's class side #new* methods to create the instances.<br>HashFunction is a facade and a factory at the same time.<br>I originally wanted to create a separate class for this role named Hasher,<br>but HashFunction seemed to work just as well.<br><br><br>Levente<br><br>><br>> Thanks again for this great work.<br>><br>>  - Chris<br>><br>><br>> On Sun, Jul 19, 2020 at 9:55 PM Levente Uzonyi <leves@caesar.elte.hu> wrote:<br>>       Hi Chris,<br>><br>>       On Sun, 19 Jul 2020, Chris Muller wrote:<br>><br>>       > Hi Robert and Levente,<br>>       ><br>>       > Yes, I *think* so!  I'm just now getting up to speed after reading<br>>       > that epic thread between you and Levente (subject line: "SHA512 squeak<br>>       > implementation").  Thanks a ton to both of you, BTW, for this work!<br>>       ><br>>       > After loading<br>>       ><br>>       >       ProCrypto-1-1-1<br>>       > and ProCryptoTests-1-1-1,<br>>       ><br>>       > all 205 tests are passing, however, it took me a bit to realize I need to use<br>>       ><br>>       >    HashFunction newSHA256<br>>       ><br>>       > instead of<br>>       ><br>>       >    SHA256 new<br>>       ><br>>       > in order to take advantage of Levente's plugin.  This is great, thanks again!<br>><br>>       That is indeed some sort of a change but it only affects those who<br>>       compiled the SHA256Plugin themselves since that plugin wasn't shipped with<br>>       the VM.<br>>       I decided against the practice of making #new return an instance of<br>>       another class than the receiver, as it was with the previous<br>>       implementation, because that makes it a lot harder for others to<br>>       understand the code.<br>><br>>       ><br>>       > Quick side question:  Is it okay to reuse a SHA256 instance, or should<br>>       > I just create a new one for each and every message to hash?<br>><br>>       All subinstances of HashFunction are reusable. The tests<br>>       (see HashFunctionTest) do exactly that.<br>><br>><br>>       Levente<br>><br>>       ><br>>       > Best,<br>>       >  Chris<br>>       ><br>>       ><br>>       > On Sat, Jul 18, 2020 at 6:02 AM Robert Withers <robert.withers@pm.me> wrote:<br>>       >><br>>       >> Hey Chris,<br>>       >><br>>       >> Did this approach fix your issues?<br>>       >><br>>       >> Kindly,<br>>       >> rabbit<br>>       >><br>>       >> On 7/13/20 11:46 PM, Robert wrote:<br>>       >><br>>       >> Hi Chris,<br>>       >><br>>       >> You should only need to run #3, which will load Registers. Hasher was from before we integrated the code into ProCrypto-1-1-1.<br>>       >><br>>       >> Installer as project: ‘Cryptography’; install: ‘ProCrypto-1-1-1’.<br>>       >><br>>       >> Then to load tests run:<br>>       >><br>>       >> Installer as project: ‘Cryptography’; install: ‘ProCryptoTests-1-1-1’.<br>>       >><br>>       >> Let us know if any tests fail and we can look into it.<br>>       >><br>>       >> Kindly,<br>>       >> Robert<br>>       >><br>>       >><br>>       >> On Mon, Jul 13, 2020 at 19:52, Chris Muller <asqueaker@gmail.com> wrote:<br>>       >><br>>       >> Hi Robert, hi Levente,<br>>       >><br>>       >> I would like to utilize the latest crypto in my next project, would<br>>       >> you help me with the current proper way to configure my image, and my<br>>       >> vm with plugins?<br>>       >><br>>       >> (image)<br>>       >> In going back through some recent messages on the mailing lists and<br>>       >> instructions on squeaksource.com, I came across these incantations as<br>>       >> current ways to load the image code:<br>>       >><br>>       >> 1) Installer ss<br>>       >> project: 'Registers';<br>>       >> install: 'Registers';<br>>       >> project: 'Hasher';<br>>       >> install: 'HAHasher-Core';<br>>       >> install: 'HAHasher-Tests'.<br>>       >><br>>       >> 2) Installer ss<br>>       >> project: 'Registers';<br>>       >> install: 'Registers';<br>>       >> project: 'Hasher';<br>>       >> install: 'HAHasher'.<br>>       >><br>>       >> 3) Installer ss project: 'Cryptography'; install: 'ProCrypto-1-1-1'.<br>>       >><br>>       >> I like these one-click-for-everything scripts for crypto -- it<br>>       >> satisfies the good use-case of development and education, and also<br>>       >> knowing all what's available to Squeak in one glance. My app's build<br>>       >> script can cherry pick what it needs, but any advice on which starting<br>>       >> point above or otherwise is appreciated.<br>>       >><br>>       >> (vm)<br>>       >> I put the SHA2Plugin.so from Roberts dropbox in the lib directory,<br>>       >> and it shows up as a "Loaded VM Module" in About Squeak. But, three<br>>       >> of the "WithPluginTest"'s are failing. My OS is linux_x64. I don't<br>>       >> know how to build Squeak or plugins from sources, but including it in<br>>       >> the standard precompiled vm would be so pertinent for Squeak today,<br>>       >> IMO. SHA256 is one of the ones I'm going to need, so would be nice to<br>>       >> have it work via plugin. I assume it's a lot faster?<br>>       >><br>>       >> Thanks,<br>>       >> Chris<br>>       >><br>>       >> On Tue, Mar 10, 2020 at 3:52 PM Levente Uzonyi <leves@caesar.elte.hu> wrote:<br>>       >>><br>>       >>><br>>       >>> Hi Robert,<br>>       >>><br>>       >>> With yesterday's help from Eliot and Nicolas, the SHA2Plugin is ready:<br>>       >>> http://squeaksource.com/Cryptography/CryptographyPlugins-ul.19.mcz<br>>       >>> The updated version of the image-side code is available in the Hasher<br>>       >>> repository. You can install it with:<br>>       >>><br>>       >>> Installer ss<br>>       >>> project: 'Registers';<br>>       >>> install: 'Registers';<br>>       >>> project: 'Hasher';<br>>       >>> install: 'HAHasher-Core';<br>>       >>> install: 'HAHasher-Tests'.<br>>       >>><br>>       >>><br>>       >>> Levente<br>>       >>><br>>       >>><br>>       >>> On Tue, 10 Mar 2020, Levente Uzonyi wrote:<br>>       >>><br>>       >>>><br>>       >>>> Hi Robert,<br>>       >>>><br>>       >>>> Please have a look at:<br>>       >>>> http://lists.squeakfoundation.org/pipermail/squeak-dev/2020-March/207851.html<br>>       >>>> It answers all your questions.<br>>       >>>><br>>       >>>><br>>       >>>> Levente<br>>       >>>><br>>       >>>> On Tue, 10 Mar 2020, Robert wrote:<br>>       >>>><br>>       >>>>> Hi Levente,<br>>       >>>>><br>>       >>>>> I got the SHA2Plugin built and deployed to my Crypto plugins folder. Now I<br>>       >>>> am trying to figure out how to call it from SHA512.<br>>       >>>>><br>>       >>>>> https://www.dropbox.com/sh/yhv253rwrhq0q5p/AAB7PKP2KPiGpDnIyule2h_Ia?dl=0<br>>       >>>>><br>>       >>>>> [plugin] I looked at it and please understand I think the classes you wrote<br>>       >>>> and the framework is really quite nice. I am thrilled we found SHA512! It's<br>>       >>>> impressive that your one plugin can handle a number of hash functions!<br>>       >>>>> Now all I need is to find the code that calls the SHA2Plugin. Levente,<br>>       >>>> would you share that code, please?<br>>       >>>>><br>>       >>>>> Kindly,<br>>       >>>>> Robert<br>>       >>>>><br>>       >>>>><br>>       >>>><br>>       >><br>>       >><br>>       >><br>>       ><br>><br>><br>></blockquote><div><br></div><div><br></div>