{"id":19455978,"url":"https://github.com/teguh02/t-encryption","last_synced_at":"2026-04-27T18:32:15.950Z","repository":{"id":59116627,"uuid":"534709796","full_name":"teguh02/T-Encryption","owner":"teguh02","description":"T-Encryption is a single file simple encryption class for PHP","archived":false,"fork":false,"pushed_at":"2022-09-12T01:50:20.000Z","size":449,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-24T14:39:06.745Z","etag":null,"topics":["decryption","decryption-algorithm","encryption","encryption-algorithms","laravel","php"],"latest_commit_sha":null,"homepage":"https://linktr.ee/teguhrijanandi","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/teguh02.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":"2022-09-09T15:57:14.000Z","updated_at":"2022-11-18T04:17:53.000Z","dependencies_parsed_at":"2022-09-12T15:22:53.927Z","dependency_job_id":null,"html_url":"https://github.com/teguh02/T-Encryption","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/teguh02/T-Encryption","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teguh02%2FT-Encryption","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teguh02%2FT-Encryption/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teguh02%2FT-Encryption/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teguh02%2FT-Encryption/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/teguh02","download_url":"https://codeload.github.com/teguh02/T-Encryption/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/teguh02%2FT-Encryption/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32349456,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-27T17:12:42.749Z","status":"ssl_error","status_checked_at":"2026-04-27T17:12:41.658Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["decryption","decryption-algorithm","encryption","encryption-algorithms","laravel","php"],"created_at":"2024-11-10T17:15:43.641Z","updated_at":"2026-04-27T18:32:15.930Z","avatar_url":"https://github.com/teguh02.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP T-Encryption  \n\nT-Encryption is a single file simple encryption class for PHP\n\n[![GitHub issues](https://img.shields.io/github/issues/teguh02/T-Encryption)](https://github.com/teguh02/T-Encryption/issues) [![GitHub forks](https://img.shields.io/github/forks/teguh02/T-Encryption)](https://github.com/teguh02/T-Encryption/network) [![GitHub stars](https://img.shields.io/github/stars/teguh02/T-Encryption)](https://github.com/teguh02/T-Encryption/stargazers) [![GitHub license](https://img.shields.io/github/license/teguh02/T-Encryption)](https://github.com/teguh02/T-Encryption) \n\nIf you use this encryption class, you can encrypt such as\n1. String\n2. File (Image, PDF)\n \nI coded this encryption classes because so many a news about Indonesian government's data are stolen by hackers and leak to the internet. I hope you enjoy this class. coded with love by Teguh Rijanandi for everyone and if you see any error or bug you can feel free to open new issue or you can collaborate with me use pull request. Thanks\n\nNote :\n- WE NEVER STORE ANY DATA / FILE FROM YOU\n- T means is Teguh (from my first letter name)\n\n# Tutorial\nBefore we start, please keep master password in encrypt and decrypt step are same and if the master password are not same, the decrypt process results is null like this\n[![Pdytu2.md.png](https://iili.io/Pdytu2.md.png)](https://freeimage.host/i/Pdytu2)\n\n## Installation\n1. Download this repository\n2. Copy t_encrypt.php file to what do you want to store, for example your root project folder\n3. Import php file use\n\n```php\nrequire_once 't_encrypt.php';\n```\n4. Please see sample code below\n\n## Encrypt data\n\n### Simple step\n```php\n\u003c?php\n\n// import class\nrequire_once 't_encrypt.php';\n\n// please change this password with your own password\n// and make sure it is not too short, and please keep it secret\n$masterpassword = \"beautiful_system\";\n\nreturn t_encrypt::setPassword($masterpassword)\n\n        // You can set input as string\n        -\u003einput('mendoan')\n\n        // and you can print as string  (PHP echo)\n        -\u003eprint();\n\n// Results\n// zyMXBNOlXqJnJohyfB1/ctdICm9weM4T4Ch3bgf5fnsIeJci4FzFeUtbEa0ZODSL54rhH39QP5Z9uW33NPO3bcVv/XiyjVljxIbp8o3P2UI=\n```\n### Encrypt uploaded file\nEncrypt uploaded file and show the encryted string\n```php\n\u003c?php\nrequire_once 't_encrypt.php';\n$masterpassword = \"beautiful_system\";\nreturn t_encrypt::setPassword($masterpassword)\n        -\u003einput($_FILES['file'])\n        -\u003eprint();\n```\nin this section i was upload a file an this the results\n\n[![PdpZLF.md.png](https://iili.io/PdpZLF.md.png)](https://freeimage.host/i/PdpZLF)\n\n### Encrypt a file use path\nEncrypt file use a path and show the encryted string\n```php\n\u003c?php\nrequire_once 't_encrypt.php';\n$masterpassword = \"beautiful_system\";\nreturn t_encrypt::setPassword($masterpassword)\n        -\u003einput(\"/Users/mymac/Downloads/DSC_0301a.jpeg\")\n        -\u003eprint();\n```\n\nand when i fetch use postman, you can see the results here\n[![PdyGTB.md.png](https://iili.io/PdyGTB.md.png)](https://freeimage.host/i/PdyGTB)\n\n## Decrypt data\n### Simple step\n\n```php\n\u003c?php\n// import the package\nrequire_once 't_encrypt.php';\n\n// please change this password with your own password\n// and make sure it is not too short, and please keep it secret\n// AND PLEASE MAKE SURE THIS PASSWORD IS THE SAME WITH THE PASSWORD IN \n// encrypt_sample.php\n$masterpassword = \"beautiful_system\";\n\n// decrypt sample\nreturn t_encrypt::setPassword($masterpassword)\n                -\u003eencrypted_string(\"M7J1nJ3i3o2pP5rBvvDVBtTTi4kqPbpmrpmNUWf5FtVi1gLULg8y4jqCvmniabpnmR1izphuXCEo/fgUtIgMmKZ9+O0aW6ev8Jff9SOwGkA=\") // mendoan\n\n                // and you can print as string  (PHP echo, image stream or pdf stream)\n                -\u003eprint();\n\n```\nand the results is\n[![P29bHv.md.png](https://iili.io/P29bHv.md.png)](https://freeimage.host/i/P29bHv)\n\n### Decrypt from file\nIn this section we want to try decrypt a hashed text from a txt file\n\n```php\n\u003c?php\nrequire_once 't_encrypt.php';\n$masterpassword = \"beautiful_system\";\n\nreturn t_encrypt::setPassword($masterpassword)\n                -\u003eencrypted_string(__DIR__ . \"/example/encrypted_string.txt\")\n\n                -\u003eprint();\n\n// Results :\n// mendoan\n\n```\n\n## Function explanation\nYou can set a master password for encryption and decryption proccess use ::setPassword function like this\n\n```php\n$t_encrypt = t_encrypt::setPassword($masterpassword)\n```\nNote :\nYou must choose only one encryption and decryption function\n\n### Encryption function\n\n#### Set Input\n1. You can set input as string use this function\n```php\n$t_encrypt = $t_encrypt-\u003einput('mendoan')\n```\n\n2. You can set input as POST file use\n```php\n$t_encrypt = $t_encrypt-\u003einput($_FILES['file'])\n```\n\n3. Or you can set input as file path use\n```php\n$t_encrypt = $t_encrypt-\u003einput(\"/Users/mymac/Downloads/Resume_Teguh Rijanandi.docx.pdf\")\n```\n\n#### Display Output \n1. You can print output as string  (PHP echo) use\n```php\n$t_encrypt = $t_encrypt-\u003eprint();\n```\n\n2. You can return the string (PHP Return) use\n```php\n$t_encrypt = $t_encrypt-\u003eshow();\n```\n\n3. or you can save as file use\nyou can type for your files extension here but we prefer to save as txt file\n```php\n$t_encrypt = $t_encrypt-\u003esaveAsFile(__DIR__ . \"/example/encrypted_pdf.txt\");\n```\n\n### Decryption function\n#### Set input\n1. You can put encrypted string like this\n```php\n$t_encrypt = $t_encrypt-\u003eencrypted_string(\"M7J1nJ3i3o2pP5rBvvDVBtTTi4kqPbpmrpmNUWf5FtVi1gLULg8y4jqCvmniabpnmR1izphuXCEo/fgUtIgMmKZ9+O0aW6ev8Jff9SOwGkA=\") // mendoan\n```\n\n2. or you can put encrypted file here\n```php\n$t_encrypt = $t_encrypt-\u003eencrypted_string(__DIR__ . \"/example/encrypted_image.txt\")\n```\n\n#### Display Output\n1. You can print as string  (PHP echo, image stream or pdf stream) use\n```php\n$t_encrypt = $t_encrypt-\u003eprint();\n```\n\nfor example i was stream a pdf file in postman\n[![P2nJFp.md.png](https://iili.io/P2nJFp.md.png)](https://freeimage.host/i/P2nJFp)\n\nand stream a image file in postman\n[![P2nOiv.md.png](https://iili.io/P2nOiv.md.png)](https://freeimage.host/i/P2nOiv)\n\n2. You can return the string (PHP Return) use\n```php\n$t_encrypt = $t_encrypt-\u003eshow();\n```\n\nfor example i will show to you a base64 image code in a postman\n[![P2ocmX.md.png](https://iili.io/P2ocmX.md.png)](https://freeimage.host/i/P2ocmX)\n\n3. or you can save as file use\nyou can type for your files extension here\n```php\n$t_encrypt = $t_encrypt-\u003esaveAsFile(__DIR__ . \"/example/decrypted_image.jpg\");\n\n// or\n\n$t_encrypt = $t_encrypt-\u003esaveAsFile(__DIR__ . \"/example/decrypted_text.txt\");\n\n```\n\nFor other code sample, you can read in encrypt_sample.php and decrypt_sample.php in this repository. And you can see encrypted and decrypted file in example folder. Thanks\n\n# Contact\nIf you want to collaborate my project or you see a bug or error please contact me via email or my linkedin, so i will fix immediatly\n\n1. teguh@rijanandi.com\n2. https://linktr.ee/teguhrijanandi","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteguh02%2Ft-encryption","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fteguh02%2Ft-encryption","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fteguh02%2Ft-encryption/lists"}