{"id":21305881,"url":"https://github.com/haskell-hvr/otp","last_synced_at":"2025-12-11T23:25:13.530Z","repository":{"id":4783016,"uuid":"5935195","full_name":"haskell-hvr/OTP","owner":"haskell-hvr","description":"Haskell implementation of One-Time Passwords algorithms","archived":false,"fork":false,"pushed_at":"2023-11-02T14:39:46.000Z","size":33,"stargazers_count":9,"open_issues_count":2,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-04T00:04:34.407Z","etag":null,"topics":["2fa-security","haskell","hotp","oath","totp"],"latest_commit_sha":null,"homepage":"https://hackage.haskell.org/package/OTP","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/haskell-hvr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2012-09-24T13:50:17.000Z","updated_at":"2023-08-22T10:46:52.000Z","dependencies_parsed_at":"2024-11-21T16:19:56.595Z","dependency_job_id":"b528f5a4-17ff-4a16-86a0-e8d91be1ffb9","html_url":"https://github.com/haskell-hvr/OTP","commit_stats":{"total_commits":33,"total_committers":5,"mean_commits":6.6,"dds":"0.36363636363636365","last_synced_commit":"ee1d6a0ffd0ad830563f2b89ef2b2b94af0e331e"},"previous_names":["hvr/otp"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/haskell-hvr/OTP","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-hvr%2FOTP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-hvr%2FOTP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-hvr%2FOTP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-hvr%2FOTP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haskell-hvr","download_url":"https://codeload.github.com/haskell-hvr/OTP/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haskell-hvr%2FOTP/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264902246,"owners_count":23681027,"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":["2fa-security","haskell","hotp","oath","totp"],"created_at":"2024-11-21T16:19:48.295Z","updated_at":"2025-12-11T23:25:13.501Z","avatar_url":"https://github.com/haskell-hvr.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `OTP`: HMAC-Based and Time-Based One-Time Passwords (HOTP \u0026 TOTP)  [![Hackage](https://img.shields.io/hackage/v/OTP.svg)](https://hackage.haskell.org/package/OTP) [![Build Status](https://travis-ci.org/haskell-hvr/OTP.svg)](https://travis-ci.org/haskell-hvr/OTP)\n\n**Please refer to the [package description](https://hackage.haskell.org/package/OTP#description) for an overview of `OTP`.**\n\n## Usage examples\n\n### Generating one-time passwords\n\nIf you need to generate HOTP password described in RFC4226, then use\n\n```haskell\n\u003e\u003e\u003e hotp SHA1 \"1234\" 100 6\n317569\n\n\u003e\u003e\u003e hotp SHA512 \"1234\" 100 6\n134131\n```\n\nOr\n\n```haskell\n\u003e\u003e\u003e totp SHA1 \"1234\" (read \"2010-10-10 00:01:00 UTC\") 30 8\n43388892\n```\n\nto generate TOTP password described in RFC6238.\n\n### Checking one-time passwords\n\n```haskell\nhotpCheck :: HashAlgorithm      -- ^ Hashing algorithm\n          -\u003e Secret             -- ^ Shared secret\n          -\u003e (Word8, Word8)     -- ^ how much counters to take lower and higher than ideal\n          -\u003e Word64             -- ^ ideal (expected) counter value\n          -\u003e Word8              -- ^ Number of digits in password\n          -\u003e Word32             -- ^ Password entered by user\n          -\u003e Bool               -- ^ True if password acceptable\n```\n\n```haskell\n\u003e\u003e\u003e hotpCheck SHA1 \"1234\" (0,0) 10 6 50897\nTrue\n\n\u003e\u003e\u003e hotpCheck SHA1 \"1234\" (0,0) 9 6 50897\nFalse\n\n\u003e\u003e\u003e hotpCheck SHA1 \"1234\" (0,1) 9 6 50897\nTrue\n```\n\nHere almost the same aguments as for `hotp` function, but there is\nalso `(0, 0)` tuple. This tuple describes range of counters to check\nin case of desynchronisation of counters between client and\nserver. I.e. if you specify `(1, 1)` and ideal counter will be `10`\nthen function will check passwords for `[9, 10, 11]` list of\ncounters.\n\nHere is the same for TOTP:\n\n```haskell\n\u003e\u003e\u003e totpCheck SHA1 \"1234\" (0, 0) (read \"2010-10-10 00:00:00 UTC\") 30 6 778374\nTrue\n\n\u003e\u003e\u003e totpCheck SHA1 \"1234\" (0, 0) (read \"2010-10-10 00:00:30 UTC\") 30 6 778374\nFalse\n\n\u003e\u003e\u003e totpCheck SHA1 \"1234\" (1, 0) (read \"2010-10-10 00:00:30 UTC\") 30 6 778374\nTrue\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell-hvr%2Fotp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaskell-hvr%2Fotp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaskell-hvr%2Fotp/lists"}