Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unix crypt() function in smalltalk/pharo

I want to encode passwords for UNIX accounts using the crypt function. I'm using pharo 1.0. I tried to install the crypto package from squeakmap, but it gaves me an error and the package seem to get partially installed (categories without class).

How can I get my password crypted? I'm willing to invoke external code, if it is required (and there's a package in SqueakMap that makes the trick in pharo).

Thanks.

like image 750
jdinunzio Avatar asked Jan 21 '23 21:01

jdinunzio


2 Answers

Look if you have a category System-Digital Signatures in your image, with a class SecureHashAlgorithm. You can then hash your password as follows:

(SecureHashAlgorithm new hashMessage: 'my password') asString
like image 199
Janko Mivšek Avatar answered Jan 28 '23 02:01

Janko Mivšek


In Pharo check the category: System-Hashing.

There you have MD5 and SHA.

Classes: SHA1, MD5NonPrimitive, MD5.

Those classes were extracted from the crypto package from squeaksource, and make them work in Pharo. Then MD5 and SHA were integrated in the core.

Cheers

like image 34
Mariano Peck Avatar answered Jan 28 '23 01:01

Mariano Peck