Perl 6 binding to crypt(3) on Unix-like systems
Clone or download
Latest commit 5e3a9f6 Apr 14, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib/Crypt Add the Changes Apr 14, 2018
t done -> done-testing Sep 4, 2015
.gitignore Add precomp stuff Dec 24, 2015
.travis.yml Alter travis config to use zef Aug 2, 2017 osx, now with Crypt::Libcrypt Apr 13, 2018
Changes Add the Changes Apr 14, 2018
LICENCE rename LICENCE as en_GB May 30, 2016
META6.json osx, now with Crypt::Libcrypt Apr 13, 2018 osx, now with Crypt::Libcrypt Apr 13, 2018


Provide a simple Perl 6 binding to POSIX crypt(3) function


This is a binding to the crypt() function that is typically defined in libcrypt on most Unix-like systems or those providing a POSIX API.

There is a single exported subroutine crypt() that perform a one-way encryption of the supplied plain text, with the provided "salt". Depending on the implementation on your system, the structure of the salt may influence the algorithm that is used to perform the encryption. The default will probably be the DES algorithm that was traditionally used to encrypt passwords on a Unix system.

Because this is intended primarily for the encryption of passwords and is "one way" (i.e. there is no mechanism to "decrypt" the crypt text,) it is not suitable for general purpose encryption.

In order to check whether a password entered by a user is correct it should be encrypted using the stored encrypted password as the "salt" - the result will be the same as the stored crypt text if the password is the same.


Currently there is no dedicated test to determine whether your platform is supported, the unit tests may simply fail horribly.

Assuming you have a working perl6 installation you should be able to install this with zef :

# From the source directory

zef install .

# Remote installation

zef install Crypt::Libcrypt

Notes for OSX this can be used with libgcrypt on OSX (if you use brew, you can brew install libgcrypt)


Suggestions/patches are welcomed via github at:

I'm not able to test on a wide variety of platforms so any help there would be appreciated. Also help with the documentation of which platforms support which encryption algorithms is probably required.


This is free software.

Please see the LICENCE file in the distribution

© Jonathan Stowe 2015, 2016, 2017