{"id":31853613,"url":"https://github.com/o/crypt-php","last_synced_at":"2025-10-12T13:32:04.717Z","repository":{"id":1198224,"uuid":"1105687","full_name":"o/crypt-php","owner":"o","description":"Library for encrypting and decrypting data with symmetric encryption","archived":false,"fork":false,"pushed_at":"2018-07-18T23:44:34.000Z","size":7,"stargazers_count":63,"open_issues_count":4,"forks_count":19,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-03-06T00:01:55.637Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/o.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2010-11-23T12:26:30.000Z","updated_at":"2025-01-22T20:10:47.000Z","dependencies_parsed_at":"2022-07-06T12:14:42.630Z","dependency_job_id":null,"html_url":"https://github.com/o/crypt-php","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/o/crypt-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o%2Fcrypt-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o%2Fcrypt-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o%2Fcrypt-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o%2Fcrypt-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/o","download_url":"https://codeload.github.com/o/crypt-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/o%2Fcrypt-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279011443,"owners_count":26084947,"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-10-12T02:00:06.719Z","response_time":53,"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":"2025-10-12T13:30:48.009Z","updated_at":"2025-10-12T13:32:04.711Z","avatar_url":"https://github.com/o.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction\n------------\ncrypt-php is class for encrypting and decrypting any data type in PHP. It uses libmcrypt and rjindael-192 (also known as AES192) algorithm. It tested on Mac OS X server and some (Ubuntu and Centos) Linux distributions.\n\nHow to use\n----------\nInclude Crypt.php to your PHP project and call Crypt class with new operator. It checks your environment is mcrypt installed correctly.\n\nEncryption\n==========\n\n\u003cpre\u003e$crypt = new Crypt;\u003c/pre\u003e\nNow provide a secret key for encrypting and decrypting given data. This secret key must 8 character at least.\n\n\u003cpre\u003e$crypt-\u003esetKey('eff99cfe6876008c6a6e080e4a382be1');\u003c/pre\u003e\nOk, if you think encrypt a complex data type like an array or object we must declare this. (This parameter is not required for scalar data types like string and numbers)\n\n\u003cpre\u003e$crypt-\u003esetComplexTypes(TRUE);\u003c/pre\u003e\nNow, we give data for encrypting.\n\n\u003cpre\u003e$crypt-\u003esetData(array('username' =\u003e 'osmanungur', 'realname' =\u003e 'Osman Üngür', 'password' =\u003e 12345, 'groups' =\u003e array(18, 34)));\u003c/pre\u003e\nAnd finally we will encrypt it !\n\n\u003cpre\u003e$encrypted = $crypt-\u003eencrypt();\n// It gives you like cryptPHP#GjHTQ1SU+WWKb/CYhjyQrKOlXvsyIkqP#xuA6\nS6NIQegeZtPjuuS9m3iy4F6yGw9cFBYIcYddJ7Y4g3lmFUObfRH3glx0Jv9ruOA9ZFx\n4p4V1Lyyb+ikmEK84z8AEFPqaRhavJ7TUACAyVRfP6mcRbnKNW8awYoaHBD23q6/jCS\nAvHXGAGBbXuVTk7yCIz3m9YnFzq3TG36edwIzDlG7L#9dbbfefa3e85c28c4b434505\n7e472a6325ccfe02\n\u003c/pre\u003e\n\nThis cipher is change on every request.\n\nDecryption\n==========\n\n\u003cpre\u003e$crypt = new Crypt;\u003c/pre\u003e\nDo you remember ? We encrypted a complex data type.\n\n\u003cpre\u003e$crypt-\u003esetComplexTypes(TRUE);\u003c/pre\u003e\nWe set key for decryption. Dont forgot your key !\n\n\u003cpre\u003e$crypt-\u003esetKey('eff99cfe6876008c6a6e080e4a382be1');\u003c/pre\u003e\nNow we will call encrypted data. Maybe it living in SQL or cookie.\n\n\u003cpre\u003e$crypt-\u003esetData('cryptPHP#GjHTQ1SU+WWKb/CYhjyQrKOlXvsyIkqP#xuA6S6NI\nQegeZtPjuuS9m3iy4F6yGw9cFBYIcYddJ7Y4g3lmFUObfRH3glx0Jv9ruOA9ZFx4p4V\n1Lyyb+ikmEK84z8AEFPqaRhavJ7TUACAyVRfP6mcRbnKNW8awYoaHBD23q6/jCSAvHX\nGAGBbXuVTk7yCIz3m9YnFzq3TG36edwIzDlG7L#9dbbfefa3e85c28c4b4345057e47\n2a6325ccfe02');\n\u003c/pre\u003e\n\nDecrypting...\n\n\u003cpre\u003e$decrypted = $crypt-\u003edecrypt();\u003c/pre\u003e\n\nOk, now we discovering on our decrypted data.\n\n\u003cpre\u003evar_dump($decrypted);\narray\n  'username' =\u003e string 'osmanungur' (length=10)\n  'realname' =\u003e string 'Osman Üngür' (length=13)\n  'password' =\u003e int 12345\n  'groups' =\u003e \n    array\n      0 =\u003e int 18\n      1 =\u003e int 34\n\u003c/pre\u003e\n\nEverything is ok ? If something went wrong please tell me whats going on from Issues page.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo%2Fcrypt-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fo%2Fcrypt-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fo%2Fcrypt-php/lists"}