{"id":20678879,"url":"https://github.com/phpgt/cipher","last_synced_at":"2026-04-24T04:33:34.600Z","repository":{"id":46380506,"uuid":"482571205","full_name":"phpgt/Cipher","owner":"phpgt","description":"Two-way encryption of messages for secure plain text transmission.","archived":false,"fork":false,"pushed_at":"2025-10-10T20:17:49.000Z","size":77,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-23T01:56:28.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","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/phpgt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["phpgt"]}},"created_at":"2022-04-17T16:10:45.000Z","updated_at":"2025-10-10T20:17:52.000Z","dependencies_parsed_at":"2025-01-17T15:15:41.863Z","dependency_job_id":"d54581f1-1cce-4925-b02f-cbce25fd2f1f","html_url":"https://github.com/phpgt/Cipher","commit_stats":{"total_commits":18,"total_committers":2,"mean_commits":9.0,"dds":0.05555555555555558,"last_synced_commit":"6b2ad3623966e9ceee969cdcd4b2b69c13988bac"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/phpgt/Cipher","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCipher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCipher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCipher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCipher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpgt","download_url":"https://codeload.github.com/phpgt/Cipher/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpgt%2FCipher/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28018788,"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","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-16T21:22:53.663Z","updated_at":"2026-04-24T04:33:34.594Z","avatar_url":"https://github.com/phpgt.png","language":"PHP","funding_links":["https://github.com/sponsors/phpgt"],"categories":[],"sub_categories":[],"readme":"Two-way encryption of messages for secure plain text transmission.\n==================================================================\n\nWhen messages are passed between two systems over a public network, encryption tools are needed to protect the content in transit. Encrypting and decrypting messages correctly can be fiddly and error-prone, so this library keeps the process small and explicit through the `PlainTextMessage`, `EncryptedMessage`, `CipherText`, `Key`, and `InitVector` abstractions.\n\nPass your secret message to the `PlainTextMessage` constructor, then call `encrypt()` with a shared `Key` to produce a `CipherText`. The encrypted payload is represented by the cipher text itself plus the IV returned by `getIv()`. Those values can then be passed to the receiver by any communication mechanism, with only the holder of the same shared key able to decrypt the original message.\n\nOn the receiving side, construct an `EncryptedMessage` with the incoming cipher text and IV, then call `decrypt()` with the same `Key` to recover the original plain text.\n\nThe `CipherText` class also provides a `getUri()` method for creating a pre-encoded URI. A URI containing `cipher` and `iv` query string parameters can then be passed to `EncryptedUri` and decrypted back into a `PlainTextMessage`.\n\n***\n\n\u003ca href=\"https://github.com/PhpGt/Cipher/actions\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cipher-build.svg\" alt=\"Build status\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codacy.com/gh/PhpGt/Cipher\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cipher-quality.svg\" alt=\"Code quality\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://app.codecov.io/gh/PhpGt/Cipher\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cipher-coverage.svg\" alt=\"Code coverage\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://packagist.org/packages/PhpGt/Cipher\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cipher-version.svg\" alt=\"Current version\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"http://www.php.gt/cipher\" target=\"_blank\"\u003e\n\t\u003cimg src=\"https://badge.status.php.gt/cipher-docs.svg\" alt=\"PHP.Gt/Cipher documentation\" /\u003e\n\u003c/a\u003e\n\n## Example usage: transmit an encrypted message over a query string\n\n`sender.php`:\n\n```php\nuse \\GT\\Cipher\\Message\\PlainTextMessage;\nuse \\GT\\Cipher\\Message\\EncryptedMessage;\n\n$privateKey = \"This can be any string, but a long random string is best.\";\n\n$message = new PlainTextMessage(\"Hello, PHP.Gt!\");\n$cipherText = $message-\u003eencrypt($privateKey);\nheader(\"Location: \" . $cipherText-\u003egetUri(\"/receiver.php\"));\n```\n\n`receiver.php`:\n\n```php\n// This key must be the same on the sender and receiver!\nuse GT\\Cipher\\EncryptedUri;\n\n$privateKey = \"This can be any string, but a long random string is best.\";\n\n$uri = new EncryptedUri($_SERVER[\"REQUEST_URI\"]);\n$plainText = $uri-\u003edecryptMessage($privateKey);\necho $plainText;\n// Output: Hello, PHP.Gt!\n```\n\n# Proudly sponsored by\n\n[JetBrains Open Source sponsorship program](https://www.jetbrains.com/community/opensource/)\n\n[![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://www.jetbrains.com/community/opensource/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fcipher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpgt%2Fcipher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpgt%2Fcipher/lists"}