Unix crypt () function in smalltalk / pharo

I want to encode passwords for UNIX accounts using the crypt function. I am using pharo 1.0. I tried installing the crypto package from squeakmap, but it gives me an error, and the package seems to be partially installed (categories without a class).

How can I encrypt my password? I am ready to call external code if necessary (and there is a package in SqueakMap that does the trick in pharo).

Thanks.

+4
source share
4 answers

See if you have the System-Digital Signatures category in your image, with the SecureHashAlgorithm class. Then you can change your password as follows:

(SecureHashAlgorithm new hashMessage: 'my password') asString 
+3
source

At Pharo, check out the category: System-Hashing.

There you have MD5 and SHA.

Classes: SHA1, MD5NonPrimitive, MD5.

These classes were extracted from the crypto package from squeaksource and made them work in Pharo. Then MD5 and SHA were integrated into the core.

Greetings

+3
source

The Cryptography repository has the PasswordHashingFFI package, which uses FFI to access the crypt (3) library on linux.

Here:

http://www.squeaksource.com/Cryptography.html

Usage is similar to

 CryptLinuxFFI sha256:'1234' 
+2
source

OSProcess can be used to call any external program. Take a look at http://book.pharo-project.org/book/PharoTools/OSProcess/

+1
source

Source: https://habr.com/ru/post/1313114/


All Articles