{"id":22859411,"url":"https://github.com/yohn/hash","last_synced_at":"2026-02-06T07:37:45.976Z","repository":{"id":264233700,"uuid":"892770753","full_name":"Yohn/Hash","owner":"Yohn","description":"An easy hashing for forms","archived":false,"fork":false,"pushed_at":"2024-11-22T19:49:25.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-14T10:55:10.166Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Yohn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2024-11-22T18:41:05.000Z","updated_at":"2024-11-22T19:48:23.000Z","dependencies_parsed_at":"2024-11-23T01:08:55.623Z","dependency_job_id":null,"html_url":"https://github.com/Yohn/Hash","commit_stats":null,"previous_names":["yohn/hash"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Yohn/Hash","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FHash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FHash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FHash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FHash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Yohn","download_url":"https://codeload.github.com/Yohn/Hash/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Yohn%2FHash/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266039739,"owners_count":23867918,"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-12-13T09:06:53.093Z","updated_at":"2026-02-06T07:37:45.942Z","avatar_url":"https://github.com/Yohn.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hash Library\n\nA secure and efficient PHP library for generating, validating, and managing tokens.\n\n---\n\n## Installation\n\nInstall the package via Composer:\n\n```bash\ncomposer require yohns/hash\n```\n\n---\n\n## Usage\n\n### 1. Generating a Token\n\nUse the `generateToken` method to create a secure token.\n\n```php\nuse Yohns\\Security\\Finding\\Hash;\n\n$token = Hash::generateToken('form-id'); // This value will be used again to validate the token\n// add token to form\necho '\u003cinput type=\"hidden\" name=\"YohnsPatch\" value=\"'.$token.'\"\u003e';\n```\n\n---\n\n### 2. Validating a Token\n\nVerify the validity of a token with the `validateToken` method.\n\n```php\nuse Yohns\\Security\\Finding\\Hash;\n\n$isValid = Hash::validateToken('form-id', $_POST['YohnsPatch']);\nif ($isValid) {\n\techo 'Token is valid!';\n} else {\n\techo 'Token is invalid or expired.';\n}\n```\n\n---\n\n### 3. Garbage Collection\n\nRemove expired tokens to maintain optimal performance.\n\n```php\nuse Yohns\\Security\\Finding\\Hash;\n\nHash::garbageCollect();\necho 'Expired tokens removed.';\n```\n\n---\n\n## Running Tests\n\nEnsure everything works as expected by running the test suite:\n\n```bash\ncomposer test\n```\n\n---\n\n## Requirements\n\n- PHP 8.1 or later, 8.3 preferred\n- Composer\n- [Yohns\\Core\\Config](https://github.com/Yohn/Config)\n\n---\n\n## License\n\nThis library is licensed under [MIT License](LICENSE).\n\n---\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyohn%2Fhash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyohn%2Fhash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyohn%2Fhash/lists"}