{"id":15412944,"url":"https://github.com/ascorbic/php-stateless-cookies","last_synced_at":"2025-04-19T11:38:11.058Z","repository":{"id":137069950,"uuid":"2164513","full_name":"ascorbic/php-stateless-cookies","owner":"ascorbic","description":"Implements secure stateless cookies and user accounts.","archived":false,"fork":false,"pushed_at":"2017-03-16T10:10:38.000Z","size":6,"stargazers_count":11,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-29T07:22:23.543Z","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/ascorbic.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2011-08-06T10:15:07.000Z","updated_at":"2022-06-29T06:49:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"b4e2d6ac-3a69-491b-88d9-b0db8b368147","html_url":"https://github.com/ascorbic/php-stateless-cookies","commit_stats":{"total_commits":6,"total_committers":4,"mean_commits":1.5,"dds":0.6666666666666667,"last_synced_commit":"c65f1cd79ce4acd257d7839005bd676fb4f739b7"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ascorbic%2Fphp-stateless-cookies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ascorbic%2Fphp-stateless-cookies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ascorbic%2Fphp-stateless-cookies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ascorbic%2Fphp-stateless-cookies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ascorbic","download_url":"https://codeload.github.com/ascorbic/php-stateless-cookies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249685231,"owners_count":21310568,"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-10-01T16:54:52.839Z","updated_at":"2025-04-19T11:38:11.024Z","avatar_url":"https://github.com/ascorbic.png","language":"PHP","readme":"This is unmaintained. Do not use unmaintained crypto!\n============\n\nImplements a stateless session cookie and user account mechanism.\nThis is based on the scheme described by Steven J. Murdoch in \"Hardened Stateless Session Cookies\", which is\na hardened version of the protocol described by Wu et al. and Liu et al. which are used by Wordpress.\nSee http://www.cl.cam.ac.uk/~sjm217/papers/protocols08cookies.pdf\n \nCopyright © 2011 Matt Kane (http://ascorbic.github.com/)\nLicensed under the MIT license.\n\nUsage\n=======\n\nPass the constructor your secret server key.\n\n```php\n    $secret = \"sekrit\";\n    $cookies = new StatelessCookie($secret);\n```\n\nA user signs up:\n\n```php\n    $hash = $cookies-\u003ehashPassword(\"password123\");\n\n    //Store $hash in your user database.\n```\n\nA user logs-in. Retrieve $storedhash from your database.\n\n```php\n    $auth = $cookies-\u003elogin(\"password123\", $storedhash);\n    $cookie = $cookies-\u003ebuildCookie(strtotime(\"+1 hour\"), 'admin', $auth);\n    setcookie(\"auth\", $cookie);\n```\n\nOn future pageloads.\n\n```php\n    $cookie = $_COOKIE['auth'];\n    $user = $cookies-\u003egetCookieData($cookie);\n    // Fetch the user's stored hash from the database...\n    $result = $cookies-\u003echeckCookie($cookie, $storedhash);\n    \n    // $result is false if the cookie is invalid, or the cookie vars as an array if it's valid.\n```\n\nRequirements\n=======\n* phpass: http://www.openwall.com/phpass/\n\n* PHP with Blowfish support. This is implemented internally in 5.3. Earlier versions require system support for it.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fascorbic%2Fphp-stateless-cookies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fascorbic%2Fphp-stateless-cookies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fascorbic%2Fphp-stateless-cookies/lists"}