{"id":17861107,"url":"https://github.com/jonathanstowe/crypt-libcrypt","last_synced_at":"2025-04-02T20:47:17.811Z","repository":{"id":31588382,"uuid":"35153184","full_name":"jonathanstowe/Crypt-Libcrypt","owner":"jonathanstowe","description":"Raku binding to crypt(3) on Unix-like systems","archived":false,"fork":false,"pushed_at":"2022-08-08T06:50:35.000Z","size":30,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-30T20:11:37.697Z","etag":null,"topics":["encryption","libcrypt","password","raku","unix"],"latest_commit_sha":null,"homepage":"","language":"Raku","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"artistic-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jonathanstowe.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-05-06T10:21:10.000Z","updated_at":"2022-08-07T08:45:29.000Z","dependencies_parsed_at":"2022-08-08T08:30:50.059Z","dependency_job_id":null,"html_url":"https://github.com/jonathanstowe/Crypt-Libcrypt","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FCrypt-Libcrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FCrypt-Libcrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FCrypt-Libcrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonathanstowe%2FCrypt-Libcrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonathanstowe","download_url":"https://codeload.github.com/jonathanstowe/Crypt-Libcrypt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246892796,"owners_count":20850846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["encryption","libcrypt","password","raku","unix"],"created_at":"2024-10-28T08:42:55.441Z","updated_at":"2025-04-02T20:47:17.566Z","avatar_url":"https://github.com/jonathanstowe.png","language":"Raku","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Crypt::Libcrypt\n\nProvide a simple Raku binding to POSIX crypt(3) function\n\n![Build Status](https://github.com/jonathanstowe/Crypt-Libcrypt/workflows/CI/badge.svg)\n\n## Synopsis\n\n        use Crypt::Libcrypt;\n\n        my $crypted = crypt($password, $salt );\n\n        # Or if crypt_gensalt is available\n\n        $crypted = crypt($password);\n\n## Description\n\n\nThis is a binding to the crypt() function that is typically defined in libcrypt on most Unix-like systems or those providing a POSIX API.\n\nThere is at least 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, this is, however, not recommended for new code: see the section \"Encryption mechanisms\" below.\n\nIf the function `crypt_gensalt` is provided by the `libcrypt` then you can call `crypt` with a single argument which will used the preferred encryption method with a generated random salt.\n\nBecause 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.\n\nIn 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.\n\nEncryption mechanisms\n---------------------\n\nDepending on the particular implementation of `crypt` on your system, there may be more than one encryption available which is determined by the structure of the provided `salt`. The default mechanism when the salt is two or more alphanumeric characters is the DES algorithm which was the original provided on Unix systems, it is however fairly weak and subject to brute force attack so should be avoided where possible.\n\nIf alternative algorithms are available they are indicated by providing a salt of the form:\n\n        $id$salt$encrypted\n\nwhere `id` identifies the encryption method to be used. The actual \"salt\" will be terminated with a `$` as it may be of variable length rather than the DES salt length of 2. The text after the third `$` will be ignored to allow an encrypted value to be passed as the salt in further calls to `crypt()`\n\nThe following values of `id` may or may not be implemented on any given system (or at all,) and the behaviour when using an un-implemented form is not specified.\n\n  * 1\n\nThe MD5 algorithm is implemented on the majority of systems as it was provided for use in places where export regulations originally prevented the use of DES.\n\n  * 2\n\nBlowfish is not implemented for `glibc` but is available on FreeBSD\n\n  * 3\n\nNT-Hash is available on FreeBSD and is intended to be compatible with Microsoft's NT scheme. It actually ignores the salt text.\n\n  * 5\n\nSHA-256\n\n  * 6\n\nSHA-512\n\nYou can probably get a description of all available methods on your system from the `crypt(5)` manpage (or e,g [https://manpages.debian.org/experimental/libcrypt1-dev/crypt.5.en.html](https://manpages.debian.org/experimental/libcrypt1-dev/crypt.5.en.html) .)\n\nIf you have a reasonably modern `libcrypt` then the subroutine `crypt-preferred-method` will return the prefix '$id$' as described above of the best and recommended encryption method. (if the library isn't sufficiently new the function will return a Str type object.) Bear in mind however if you need to pass the hashed password to other software, there may be other constraints on the methods you can use.\n\n## Installation\n\nCurrently there is no dedicated test to determine whether your platform is supported, the unit tests may simply fail horribly.\n\nAssuming you have a working Rakudo installation you should be able to install this with *zef* :\n\n    # From the source directory\n   \n    zef install .\n\n    # Remote installation\n\n    zef install Crypt::Libcrypt\n\n*Notes for OSX* this can be used with libgcrypt on OSX (if you use brew, you can `brew install libgcrypt`)\n\n## Support\n\nSuggestions/patches are welcomed via github at:\n\nhttps://github.com/jonathanstowe/Crypt-Libcrypt/issues\n\nI'm not able to test on a wide variety of platforms so any help there would be \nappreciated. Also help with the documentation of which platforms support\nwhich encryption algorithms is probably required.\n\n## Licence\n\nThis is free software.\n\nPlease see the [LICENCE](LICENCE) file in the distribution\n\n© Jonathan Stowe 2015 - 2021\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanstowe%2Fcrypt-libcrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonathanstowe%2Fcrypt-libcrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonathanstowe%2Fcrypt-libcrypt/lists"}