{"id":15136604,"url":"https://github.com/appwrite/php-scrypt","last_synced_at":"2025-10-19T15:32:25.549Z","repository":{"id":39572948,"uuid":"507037338","full_name":"appwrite/php-scrypt","owner":"appwrite","description":null,"archived":false,"fork":false,"pushed_at":"2022-07-25T13:53:31.000Z","size":195,"stargazers_count":13,"open_issues_count":0,"forks_count":1,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-01-31T18:45:41.905Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dockerfile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/appwrite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-24T14:19:31.000Z","updated_at":"2024-10-29T03:35:34.000Z","dependencies_parsed_at":"2022-07-13T07:51:17.595Z","dependency_job_id":null,"html_url":"https://github.com/appwrite/php-scrypt","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appwrite%2Fphp-scrypt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appwrite%2Fphp-scrypt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appwrite%2Fphp-scrypt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/appwrite%2Fphp-scrypt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/appwrite","download_url":"https://codeload.github.com/appwrite/php-scrypt/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237163067,"owners_count":19265207,"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":[],"created_at":"2024-09-26T06:40:16.452Z","updated_at":"2025-10-19T15:32:25.192Z","avatar_url":"https://github.com/appwrite.png","language":"Dockerfile","funding_links":[],"categories":["Cryptography \u0026 Security"],"sub_categories":[],"readme":"# PHP Scrypt\n\n[![Discord](https://img.shields.io/discord/564160730845151244?label=discord\u0026style=flat-square)](https://appwrite.io/discord)\n[![Twitter Account](https://img.shields.io/twitter/follow/appwrite?color=00acee\u0026label=twitter\u0026style=flat-square)](https://twitter.com/appwrite)\n[![Follow Appwrite on StackShare](https://img.shields.io/badge/follow%20on-stackshare-blue?style=flat-square)](https://stackshare.io/appwrite)\n[![appwrite.io](https://img.shields.io/badge/appwrite-.io-f02e65?style=flat-square)](https://appwrite.io)\n\nA simple PHP Extension written in Rust to create scrypt password hashes. Supports building on X86-64 and ARM platforms.\n\n## Installation\n\n### Compiling Requirements\n- Linux, MacOS or Windows-based operating system\n- Latest Version of Rust Stable\n- PHP 8.0 or newer\n- Clang 5.0 or Later\n\n### Notes for Windows compilation\n- This extension can only be compiled for PHP installations sourced from https://windows.php.net.\n- Rust Nightly is required for Windows compilation.\n- This extension requires the `cl.exe` compiler. This is usually bundled with Visual Studio.\n- Stub generation does not work on Windows.\n\n### Building The Extension\nClone the repository into your project directory.\n```bash\ngit clone https://github.com/appwrite/php-scrypt.git \u0026\u0026 \\\ncd php-scrypt\n```\nCompile the extension\n```bash\ncargo build --release\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\n\n### Building for Alpine\n\n\u003c/summary\u003e\nWhile writing this extension we found out that [Rust in general](https://github.com/rust-lang/rust/issues/59302) still has a few issues with [musl libc](https://musl.libc.org/) found in Alpine. It is possible to build this project successfully by using an alternative linker and building on a gnu-based system targetting `linux-unknown-musl`.\n\nWe strongly recommend using [zigbuild](https://github.com/messense/cargo-zigbuild) as the linker for this project as we found it's the most stable and easy to install alternate linker. we also use the \"-C target-feature=crt-static\" compiler flags to aid with building on musl as stated [here](https://github.com/rust-lang/rust/issues/59302).\n\nThe build command for these platforms will look like so:\n```sh\nRUSTFLAGS=\"-C target-feature=-crt-static\" cargo zigbuild --workspace --all-targets --target x86_64-unknown-linux-musl --release\n```\nThis will produce a .so file similar to a normal build.\n\u003c/details\u003e\n\n### Installing the Extension\nCopy the compiled extension from the `target` directory into your PHP extension directory.\n\nIf you don't know where your PHP extension directory is you can run the following command:\n```bash\nphp -i | grep extension_dir\n```\n\nCopy the extension to the directory outputted\n```bash\ncp target/release/libphp-scrypt.so /path/to/extension_dir\n```\n\n\u003e Depending on your OS, your extension may end with `.dll` for windows or `.dylib` for macOS.\n\n### Enabling the extension\n\nAfter compiling and moving the extension into the correct directory, you can enable the extension by adding the following line to your `php.ini` file:\n\n```\nextension=libphp-scrypt.so\n```\n\u003e Change .so to .dll for Windows or .dylib for macOS.\n\n## Usage\nUsing the scrypt extension is easy, there is only one function in this extension the usage is as follows:\n```php\n\u003c?php\n/**\n* @param $password The string you want to hash (required)\n* @param $salt The salt you want to use (required)\n* @param $cpu_difficulty The CPU difficulty [default=32768]\n* @param $memory_difficulty The memory difficulty [default=8]\n* @param $parallel_difficulty The parallel difficulty [default=1]\n* @param $len The length of the generated hash [default=8]\n**/\n\n$hash = \\scrypt(\"password\", \"salt\", 32768, 8, 1, 64);\n\\var_dump(\"Your hash is \" . $hash);\n```\n\n## Authors\n\n**Bradley Schofield**\n\n-   [https://github.com/pineappleionic](https://github.com/pineappleionic)\n\n**Matej Bačo**\n\n-   [https://github.com/meldiron](https://github.com/meldiron)\n\n**Eldad Fux**\n-   [https://github.com/eldadfux](https://github.com/eldadfux)\n\n## Special Thanks\n-  [davidcole1340](https://github.com/davidcole1340) -  For developing the [ext-php-rs](https://github.com/davidcole1340/ext-php-rs) bindings used for this project.\n\n## Contributing\n\nAll code contributions - including those of people having commit access - must go through a pull request and approved by a core developer before being merged. This is to ensure proper review of all the code.\n\nWe truly ❤️ pull requests! If you wish to help, you can learn more about how you can contribute to this project in the [contribution guide](CONTRIBUTING.md).\n\n## Copyright and license\n\nThe MIT License (MIT) http://www.opensource.org/licenses/mit-license.php","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappwrite%2Fphp-scrypt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fappwrite%2Fphp-scrypt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fappwrite%2Fphp-scrypt/lists"}