{"id":22889734,"url":"https://github.com/SajadTroy/crypash","last_synced_at":"2025-10-22T00:31:00.883Z","repository":{"id":213898423,"uuid":"735211456","full_name":"mrsajadpp/crypash","owner":"mrsajadpp","description":"A lightweight and secure npm package providing a SHA-256 hashing algorithm implementation in pure JavaScript. Use this package to easily hash sensitive data for various applications, ensuring data integrity and security.","archived":false,"fork":false,"pushed_at":"2023-12-24T04:35:35.000Z","size":4413,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-25T18:02:30.208Z","etag":null,"topics":["encryption","hashing","hashing-algorithm","sha256"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/crypash","language":"TypeScript","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/mrsajadpp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-12-24T04:21:33.000Z","updated_at":"2023-12-24T04:23:28.000Z","dependencies_parsed_at":"2023-12-24T06:28:23.246Z","dependency_job_id":"7598645d-1a2a-4bd9-8810-55578caeecda","html_url":"https://github.com/mrsajadpp/crypash","commit_stats":null,"previous_names":["mrsajadpp/crypash"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsajadpp%2Fcrypash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsajadpp%2Fcrypash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsajadpp%2Fcrypash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrsajadpp%2Fcrypash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrsajadpp","download_url":"https://codeload.github.com/mrsajadpp/crypash/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237569029,"owners_count":19331470,"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":["encryption","hashing","hashing-algorithm","sha256"],"created_at":"2024-12-13T21:56:46.603Z","updated_at":"2025-10-22T00:30:59.253Z","avatar_url":"https://github.com/mrsajadpp.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# crypash\n\nA lightweight and secure npm package providing a SHA-256 hashing algorithm implementation in pure JavaScript. Use this package to easily hash sensitive data for various applications, ensuring data integrity and security.\n\n## Installation\n\nYou can install `crypash` using npm:\n\n```bash\nnpm install crypash\n```\n\n## Usage\n\n```typescript\n// Import the crypash module\nconst crypash = require('crypash');\n\nconst inputText = \"Hello, World!\";\nconst algorithmToUse = 'sha256';\nconst hashedValue = crypash.hash(algorithmToUse, inputText);\n\nif (crypash.check(algorithmToUse, inputText, hashedValue)) {\n  console.log(\"Text matches the hashed value.\");\n} else {\n  console.log(\"Text does not match the hashed value.\");\n}\n```\n\n## API\n\n### `hash(algorithm: Algorithm, input: string): string`\n\nThis function hashes the input data using the specified algorithm.\n\n- `algorithm` (string): The hashing algorithm to use. Currently, only `'sha256'` is supported.\n- `input` (string): The data to be hashed.\n\nReturns the hashed value as a hexadecimal string.\n\n### `check(algorithm: Algorithm, input: string, hashedString: string): boolean`\n\nThis function checks if a given text, when hashed, matches a provided hashed value.\n\n- `algorithm` (string): The hashing algorithm to use. Currently, only `'sha256'` is supported.\n- `input` (string): The original text.\n- `hashedString` (string): The hashed value to compare against.\n\nReturns `true` if the text matches the hashed value, and `false` otherwise.\n\n## Example\n\n```typescript\n// Import the crypash module\nconst crypash = require('crypash');\n\nconst inputText = \"Example Data\";\nconst algorithmToUse = 'sha256';\nconst hashedValue = crypash.hash(algorithmToUse, inputText);\n\nif (crypash.check(algorithmToUse, inputText, hashedValue)) {\n  console.log(\"Text matches the hashed value.\");\n} else {\n  console.log(\"Text does not match the hashed value.\");\n}\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSajadTroy%2Fcrypash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSajadTroy%2Fcrypash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSajadTroy%2Fcrypash/lists"}