Mantis - Squeak Packages
Viewing Issue Advanced Details
7393 Cryptography minor always 09-02-09 15:12 03-11-11 01:41
nicolas cellier  
0007393: Avoid #mousePoint to make cryptography Pharo-friendly
I suggest to replace:

so as to be Pharo-compatible.

 Cryptography-DanielLyons.37.mcz [^] (239,684 bytes) 03-11-11 01:40

03-10-11 14:44   
Hi Daniel,

Any source for Entropy is optional. The more we have the better. You will notice that there are a number of different sources for entropy. #responsdsTo: is probably what you are looking for. Adding a source that is comparable in Pharo that is missed by Squeak and leaving one that works in Squeak that is missed by Pharo is a very good solution, in my opinion. Since the methods really only collect a seed they are called very infrequently. Adding a check for respondsTo: will not harm performance in any significant way.

All the best,


> -----Original Message-----
> From: Daniel Lyons []
> Sent: Thursday, March 10, 2011 2:10 AM
> To: Ron Teitelbaum
> Subject: Re: Cryptography package
> On Mar 9, 2011, at 9:22 PM, Ron Teitelbaum wrote:
> > Hi Daniel,
> >
> > The issues is probably from the changes in Pharo vs. Squeak. I would
> > imagine that the change is in Random where we are gathering entropy to
> > try to seed the generator. The best thing to do is file a bug on
> > mantis at I'm not exactly sure how to tell if I'm on
> > Pharo or on Squeak but it would be nice to be able to support both.
> > You could upload your patch to the bug.
> There's already an issue for it: [^]
> The code is in RandomGenerator as you supposed. I'll see if I can figure out
> how to tell which kind of image code is loaded into. Sensor cursorPoint
> doesn't do the same things as Sensor mousePoint, apparently, which is a
> shame because Squeak has this method too. I think the selector we actually
> want in Pharo is peekMousePt, which also returns a point that changes when
> I move the mouse. I don't know how to do this, but I believe it should be
> possible to look for the existence of this method and not the other at
> package load time and patch it.
> In thinking about it though, I'm not sure it's a good idea to rely on this
> anyway, since there's not going to be a mouse position in a headless session
> such as on a server anyway. Is there? Forgive me, I'm very new at Smalltalk!
> Thanks again!
> Daniel Lyons
03-11-11 01:41   
This patch uses mousePoint if it can, or peekMousePt if that doesn't work. Otherwise it uses 0@0. That should make it reasonably portable.

Tested under Pharo 1.1 and Squeak 4.2.