{"id":17498344,"url":"https://github.com/simonepri/tsse","last_synced_at":"2026-03-04T20:32:19.305Z","repository":{"id":57381854,"uuid":"99228655","full_name":"simonepri/tsse","owner":"simonepri","description":"⏱ Timing safe string equals.","archived":false,"fork":false,"pushed_at":"2022-06-05T18:20:25.000Z","size":129,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-11T01:53:13.241Z","etag":null,"topics":["constant-time","string-equals","time-attack"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/simonepri.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}},"created_at":"2017-08-03T12:08:50.000Z","updated_at":"2023-11-23T06:06:11.000Z","dependencies_parsed_at":"2022-09-04T08:11:56.371Z","dependency_job_id":null,"html_url":"https://github.com/simonepri/tsse","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/simonepri/tsse","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Ftsse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Ftsse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Ftsse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Ftsse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonepri","download_url":"https://codeload.github.com/simonepri/tsse/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonepri%2Ftsse/sbom","scorecard":{"id":824737,"data":{"date":"2025-08-11","repo":{"name":"github.com/simonepri/tsse","commit":"909359871a502ef5bbefd63a3e3c24977ed49da3"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/lint.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/lint.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-macos.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-macos.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-macos.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-macos.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-macos.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-macos.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-ubuntu.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-ubuntu.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-ubuntu.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-ubuntu.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-ubuntu.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-ubuntu.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-windows.yml:19: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-windows.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test-windows.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-windows.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test-windows.yml:42: update your workflow using https://app.stepsecurity.io/secureworkflow/simonepri/tsse/test-windows.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/lint.yml:22","Warn: npmCommand not pinned by hash: .github/workflows/test-macos.yml:26","Warn: npmCommand not pinned by hash: .github/workflows/test-macos.yml:30","Warn: npmCommand not pinned by hash: .github/workflows/test-ubuntu.yml:26","Warn: npmCommand not pinned by hash: .github/workflows/test-ubuntu.yml:30","Info:   0 out of   8 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   0 out of   5 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lint.yml:1","Warn: no topLevel permission defined: .github/workflows/test-macos.yml:1","Warn: no topLevel permission defined: .github/workflows/test-ubuntu.yml:1","Warn: no topLevel permission defined: .github/workflows/test-windows.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license:0","Info: FSF or OSI recognized license: MIT License: license:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-23T16:24:53.884Z","repository_id":57381854,"created_at":"2025-08-23T16:24:53.884Z","updated_at":"2025-08-23T16:24:53.884Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30091775,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T19:41:02.502Z","status":"ssl_error","status_checked_at":"2026-03-04T19:40:05.550Z","response_time":59,"last_error":"SSL_read: 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":["constant-time","string-equals","time-attack"],"created_at":"2024-10-19T16:30:11.275Z","updated_at":"2026-03-04T20:32:17.877Z","avatar_url":"https://github.com/simonepri.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cb\u003etsse\u003c/b\u003e\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\n  \u003c!-- Version - npm --\u003e\n  \u003ca href=\"https://www.npmjs.com/package/tsse\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/tsse.svg\" alt=\"Latest version on npm\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Downloads - npm --\u003e\n  \u003ca href=\"https://npm-stat.com/charts.html?package=tsse\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/dt/tsse.svg\" alt=\"Downloads on npm\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- License - MIT --\u003e\n  \u003ca href=\"https://github.com/simonepri/tsse/tree/master/license\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/simonepri/tsse.svg\" alt=\"Project license\" /\u003e\n  \u003c/a\u003e\n\n  \u003cbr/\u003e\n\n  \u003c!-- Lint --\u003e\n  \u003ca href=\"https://github.com/simonepri/tsse/actions?query=workflow:lint+branch:master\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/tsse/workflows/lint/badge.svg?branch=master\" alt=\"Lint status\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test - macOS --\u003e\n  \u003ca href=\"https://github.com/simonepri/tsse/actions?query=workflow:test-macos+branch:master\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/tsse/workflows/test-macos/badge.svg?branch=master\" alt=\"Test macOS status\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test - Ubuntu --\u003e\n  \u003ca href=\"https://github.com/simonepri/tsse/actions?query=workflow:test-ubuntu+branch:master\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/tsse/workflows/test-ubuntu/badge.svg?branch=master\" alt=\"Test Ubuntu status\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test - Windows --\u003e\n  \u003ca href=\"https://github.com/simonepri/tsse/actions?query=workflow:test-windows+branch:master\"\u003e\n    \u003cimg src=\"https://github.com/simonepri/tsse/workflows/test-windows/badge.svg?branch=master\" alt=\"Test Windows status\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Coverage - Codecov --\u003e\n  \u003ca href=\"https://codecov.io/gh/simonepri/tsse\"\u003e\n    \u003cimg src=\"https://img.shields.io/codecov/c/github/simonepri/tsse/master.svg\" alt=\"Codecov Coverage report\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- DM - Snyk --\u003e\n  \u003ca href=\"https://snyk.io/test/github/simonepri/tsse?targetFile=package.json\"\u003e\n    \u003cimg src=\"https://snyk.io/test/github/simonepri/tsse/badge.svg?targetFile=package.json\" alt=\"Known Vulnerabilities\" /\u003e\n  \u003c/a\u003e\n\n  \u003cbr/\u003e\n\n  \u003c!-- Code Style - XO-Prettier --\u003e\n  \u003ca href=\"https://github.com/xojs/xo\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/code_style-XO+Prettier-5ed9c7.svg\" alt=\"XO Code Style used\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test Runner - AVA --\u003e\n  \u003ca href=\"https://github.com/avajs/ava\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/test_runner-AVA-fb3170.svg\" alt=\"AVA Test Runner used\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Test Coverage - Istanbul --\u003e\n  \u003ca href=\"https://github.com/istanbuljs/nyc\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/test_coverage-NYC-fec606.svg\" alt=\"Istanbul Test Coverage used\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Init - ni --\u003e\n  \u003ca href=\"https://github.com/simonepri/ni\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/initialized_with-ni-e74c3c.svg\" alt=\"NI Scaffolding System used\" /\u003e\n  \u003c/a\u003e\n  \u003c!-- Release - np --\u003e\n  \u003ca href=\"https://github.com/sindresorhus/np\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/released_with-np-6c8784.svg\" alt=\"NP Release System used\" /\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  ⏱ Constant time string/buffer equals.\n\n  \u003cbr/\u003e\n\n  \u003csub\u003e\n    Coded with ❤️ by \u003ca href=\"#authors\"\u003eSimone Primarosa\u003c/a\u003e.\n  \u003c/sub\u003e\n\u003c/p\u003e\n\n## Synopsis\ntsse is a string comparison algorithm to prevent Node.js timing attacks.\n\n\u003e This differs from `crypto.timingSafeEqual` because it: \n\u003e  - supports both `strings` and `Buffers`;\n\u003e  - supports inputs of different lengths.\n\n## Install\n\n```\n$ npm install --save tsse\n```\n\n## Usage\n\n```js\nconst tsse = require('tsse');\n\nconst hash      = '0a4d55a8d778e5022fab701977c5d840bbc486d0';\nconst givenHash = '1265a5eb08997ced279d3854629cba68a378b528';\n\nif (tsse(hash, givenHash)) {\n  console.log('good hash');\n} else {\n  console.log('bad hash');\n}\n// =\u003e bad hash\n```\n\n## API\n\n\u003ca name=\"tsse\"\u003e\u003c/a\u003e\n\n### tsse(hiddenStr, inputStr) ⇒ \u003ccode\u003eboolean\u003c/code\u003e\nDoes a constant-time String comparison.  \nNOTE: When `hiddenStr` and `inputStr` have different lengths `hiddenStr` is compared to itself, which makes the comparison non-commutative (time-wise).\n\n**Kind**: global function  \n**Returns**: \u003ccode\u003eboolean\u003c/code\u003e - true if equals, false otherwise.  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| hiddenStr | \u003ccode\u003estring\u003c/code\u003e \\| \u003ccode\u003eBuffer\u003c/code\u003e | A string that you don't want to leak. |\n| inputStr | \u003ccode\u003estring\u003c/code\u003e \\| \u003ccode\u003eBuffer\u003c/code\u003e | Another string. |\n\n## Contributing\nContributions are REALLY welcome and if you find a security flaw in this code, PLEASE [report it][new issue].\n\n## Authors\n- **Simone Primarosa** - *Github* ([@simonepri][github:simonepri]) • *Twitter* ([@simoneprimarosa][twitter:simoneprimarosa])\n\nSee also the list of [contributors][contributors] who participated in this project.\n\n## License\nThis project is licensed under the MIT License - see the [license][license] file for details.\n\n\n\u003c!-- Links --\u003e\n[new issue]: https://github.com/simonepri/tsse/issues/new\n[contributors]: https://github.com/simonepri/tsse/contributors\n\n[license]: https://github.com/simonepri/tsse/tree/master/license\n\n[github:simonepri]: https://github.com/simonepri\n[twitter:simoneprimarosa]: http://twitter.com/intent/user?screen_name=simoneprimarosa\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonepri%2Ftsse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonepri%2Ftsse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonepri%2Ftsse/lists"}