{"id":22941491,"url":"https://github.com/phicorp/cipher","last_synced_at":"2025-08-12T21:32:05.850Z","repository":{"id":198574566,"uuid":"701082582","full_name":"phiCorp/cipher","owner":"phiCorp","description":"Cipher: A tool for easier working with cryptography for PHP language","archived":false,"fork":false,"pushed_at":"2024-10-11T15:29:47.000Z","size":22,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-14T22:42:30.723Z","etag":null,"topics":["aes","cipher","hash","phi","php","rsa"],"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/phiCorp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-05T22:02:37.000Z","updated_at":"2024-10-11T15:29:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"35ed4791-94a2-454f-ba74-13b46936c952","html_url":"https://github.com/phiCorp/cipher","commit_stats":null,"previous_names":["phicorp/cipher"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiCorp%2Fcipher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiCorp%2Fcipher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiCorp%2Fcipher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiCorp%2Fcipher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phiCorp","download_url":"https://codeload.github.com/phiCorp/cipher/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229710517,"owners_count":18111611,"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":["aes","cipher","hash","phi","php","rsa"],"created_at":"2024-12-14T13:44:03.891Z","updated_at":"2024-12-14T13:44:04.452Z","avatar_url":"https://github.com/phiCorp.png","language":"PHP","readme":"\n# Cipher\n\nA tool for easier working with cryptography for PHP language\n\n\n## Installation\n\nInstall Cipher with composer\n\n```bash\ncomposer require phicorp/cipher\n```\n    \n## Features\n\n- Easy to use\n- Symmetric encryption and decryption with powerful AES algorithm\n- Asymmetric encryption and decryption with RSA algorithm\n- A variety of hash algorithms such as SHA and Bcrypt\n- And more features\n## Usage/Examples\n\n* Symmetric encryption and decryption:\n\n```php\n$key = Cipher::AESKEY();\n$iv = Cipher::AESIV();\n\n$plaintext = 'Hello World!';\n\n$ciphertext = encrypt($plaintext, $key, $iv);\n\n$decryptedText = decrypt($ciphertext, $key, $iv);\n\necho \"Original: $plaintext\\n\";\necho \"Encrypted: $ciphertext\\n\";\necho \"Decrypted: $decryptedText\\n\";\n```\n\nOr\n\n```php\n$key = Cipher::AESKEY();\n$iv = Cipher::AESIV();\n\n$plaintext = 'Hello World!';\n\n$ciphertext = Cipher::AES()-\u003ekey($key)-\u003eiv($iv)-\u003eencrypt($plaintext);\n\n$decryptedText = Cipher::AES()-\u003ekey($key)-\u003eiv($iv)-\u003edecrypt($ciphertext);\n\necho \"Original: $plaintext\\n\";\necho \"Encrypted: $ciphertext\\n\";\necho \"Decrypted: $decryptedText\\n\";\n```\n\n* GCM Mode symmetric encryption and decryption\n\n```php\n$key = Cipher::AESKEY(\"AES-256-GCM\");\n$iv = Cipher::AESIV();\n$tag = null;\n\n$plaintext = 'Hello World!';\n\n$ciphertext = Cipher::AES('GCM')-\u003ekey($key)-\u003eiv($iv)-\u003eencrypt($plaintext, 0, $tag);\n\n$decryptedText = Cipher::AES('GCM')-\u003ekey($key)-\u003eiv($iv)-\u003edecrypt($ciphertext, 0, $tag);\n\necho \"Original: $plaintext\\n\";\necho \"Encrypted: $ciphertext\\n\";\necho \"Decrypted: $decryptedText\\n\";\n```\n-----------\n* Examples for asymmetric encryption and decryption\n```php\n[$publicKey, $privateKey] = Cipher::RSAKEY();\n\n$plaintext = 'hello world!';\n\n$ciphertext = RSA($publicKey, $privateKey)-\u003eencryptPublic($plaintext);\n$decryptedText = RSA($publicKey, $privateKey)-\u003edecryptPrivate($ciphertext);\n\necho \"Original: $plaintext\\n\";\necho \"Encrypted: $ciphertext\\n\";\necho \"Decrypted: $decryptedText\\n\";\n\n// You can also use it in this way\n\n[$publicKey, $privateKey] = Cipher::RSAKEY();\n\n$plaintext = 'hello world!';\n\n$ciphertext = Cipher::RSA()-\u003eprivateKey($privateKey)-\u003eencryptPrivate($plaintext);\n$decryptedText = RSA()-\u003epublicKey($publicKey)-\u003edecryptPublic($ciphertext);\n\necho \"Original: $plaintext\\n\";\necho \"Encrypted: $ciphertext\\n\";\necho \"Decrypted: $decryptedText\\n\";\n```\n\n-----------\n\n* Example of using hash functions\n```php\nsha512('Hello World!');\n//output: 861844d6704e...\nsha256('Hello World!');\n//output: 7f83b1657ff1...\n```\n\n```php\n$hash = bcrypt('password', 15);\n\nvar_dump(bcrypt_verify('password', $hash));\n// output: true\n```\n\n## Authors\n\n- [@thephibonacci](https://www.github.com/thephibonacci)\n\n\n## License\n\n[MIT](https://choosealicense.com/licenses/mit/)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphicorp%2Fcipher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphicorp%2Fcipher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphicorp%2Fcipher/lists"}