{"_id":"@alvin_sudarta/primehash","_rev":"2-d3d318f13cab85aa7a6c751d351279be","name":"@alvin_sudarta/primehash","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.0":{"name":"@alvin_sudarta/primehash","version":"1.0.0","keywords":["password","hashing","keccak","sponge","salt","prime","cryptography","security","bcrypt","pbkdf","hmac","sha"],"author":{"name":"Alvin Sudarta","email":"21.alvinsudarta@gmail.com"},"license":"MIT","_id":"@alvin_sudarta/primehash@1.0.0","maintainers":[{"name":"alvin_sudarta","email":"21.alvinsudarta@gmail.com"}],"homepage":"https://github.com/AlvinSudarta/primehash#readme","bugs":{"url":"https://github.com/AlvinSudarta/primehash/issues"},"dist":{"shasum":"bb8b72cde4457ddd03de45d05cdae1fcf28eba08","tarball":"https://registry.npmjs.org/@alvin_sudarta/primehash/-/primehash-1.0.0.tgz","fileCount":3,"integrity":"sha512-81Bl6dlQ6qfgJVoCTGLapFEU0o/SNEDiR4sUazhyMN5mDJ0LLfVypIzHjcqE0gXABK54Kn0I8MqP6l7X5SMdTw==","signatures":[{"sig":"MEUCIQCHbcmQlXYFfr8wrJMJ3BOHpyx5yjqEsa8tiC6wnobJ0QIgIDNujAYIZtCFTVoiwJbT/OTdLCGuwkjfH9FwJ5Jp7aY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":23599},"main":"primehash.js","browser":"primehash.min.js","gitHead":"aa72706e329ebd81e05a031bbd56fb8a9325b988","_npmUser":{"name":"alvin_sudarta","email":"21.alvinsudarta@gmail.com"},"repository":{"url":"git+https://github.com/AlvinSudarta/primehash.git","type":"git"},"_npmVersion":"10.9.2","description":"An original password hashing scheme integrating a Keccak-based sponge construction with an adaptive prime-number-based salting mechanism.","directories":{},"_nodeVersion":"22.14.0","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/primehash_1.0.0_1774710496949_0.5738573001433196","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alvin_sudarta/primehash","version":"1.0.1","description":"An original password hashing scheme integrating a Keccak-based sponge construction with an adaptive prime-number-based salting mechanism.","main":"primehash.js","browser":"primehash.min.js","keywords":["password","hashing","keccak","sponge","salt","prime","cryptography","security","bcrypt","pbkdf","hmac","sha"],"author":{"name":"Alvin Sudarta","email":"21.alvinsudarta@gmail.com"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/AlvinSudarta/primehash.git"},"bugs":{"url":"https://github.com/AlvinSudarta/primehash/issues"},"homepage":"https://github.com/AlvinSudarta/primehash#readme","_id":"@alvin_sudarta/primehash@1.0.1","gitHead":"aa72706e329ebd81e05a031bbd56fb8a9325b988","_nodeVersion":"22.14.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-TDjIDo2kOfNEbA+hzesiG0h0eTzPTBUHCFydb3Pw/nsJ4b8olJg4AZX0o17sxUYfot76QWFRMnCkH9HzCVQ1Qg==","shasum":"a7be1c4be55ceb33b0f416fd5db9f42f557db18d","tarball":"https://registry.npmjs.org/@alvin_sudarta/primehash/-/primehash-1.0.1.tgz","fileCount":4,"unpackedSize":26291,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCjMOjrfa4vx5F1r8KJAI4nv0oRFpylTH2JjSDj269IjAIhAIsL4aI25H8DoXsUk5W6eTZOr1Nin+jcxnM7QKHaLrwq"}]},"_npmUser":{"name":"alvin_sudarta","email":"21.alvinsudarta@gmail.com"},"directories":{},"maintainers":[{"name":"alvin_sudarta","email":"21.alvinsudarta@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/primehash_1.0.1_1774716574747_0.6972946980744323"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-28T15:08:16.867Z","modified":"2026-03-28T16:49:35.037Z","1.0.0":"2026-03-28T15:08:17.089Z","1.0.1":"2026-03-28T16:49:34.931Z"},"bugs":{"url":"https://github.com/AlvinSudarta/primehash/issues"},"author":{"name":"Alvin Sudarta","email":"21.alvinsudarta@gmail.com"},"license":"MIT","homepage":"https://github.com/AlvinSudarta/primehash#readme","keywords":["password","hashing","keccak","sponge","salt","prime","cryptography","security","bcrypt","pbkdf","hmac","sha"],"repository":{"type":"git","url":"git+https://github.com/AlvinSudarta/primehash.git"},"description":"An original password hashing scheme integrating a Keccak-based sponge construction with an adaptive prime-number-based salting mechanism.","maintainers":[{"name":"alvin_sudarta","email":"21.alvinsudarta@gmail.com"}],"readme":"# PrimeHash\n\nAn original password hashing scheme integrating a Keccak-based **Sponge Structure** with an adaptive **Built-In Salting** mechanism based on prime numbers. \n\nNo server required — runs entirely in the browser or Node.js with zero dependencies!\n\n## Features\n- **Sponge Construction**: Resilient against Length Extension Attacks.\n- **Adaptive Prime Salting**: A 64-bit dynamic salt is embedded securely inside the output structure, placed deterministically using a prime number sequence.\n- **Zero Dependencies**: Pure Javascript implementation.\n- **ISO/IEC 10118-1:2016 Compliant**: Evaluated design for collision and pre-image resistance.\n\n## Quick Start\n\n### 1. Installation\n\n**Using NPM (Node.js)**\n```bash\nnpm install @alvin_sudarta/primehash\n```\n\n**Using CDN (Browser)**\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@alvin_sudarta/primehash@1.0.1/primehash.min.js\"></script>\n```\n\n### 2. API Usage\n\n#### Hash a Password\nGenerates a new hash with a built-in 64-bit random salt. *You do not need to store the salt separately in your database.*\n```javascript\nconst PrimeHash = require('@alvin_sudarta/primehash');\n\n// PrimeHash.hash(password, round, length)\nconst hash = PrimeHash.hash(\"mypassword\", 24, 32);\nconsole.log(hash); \n// Output: a 64-character hex string (32 bytes) containing the embedded salt\n```\n\n#### Verify a Password\nVerifies the plaintext password against the stored hash by reconstructing the prime-based position map and validating the internal salt.\n```javascript\n// PrimeHash.verify(password, round, storedHash)\nconst result = PrimeHash.verify(\"mypassword\", 24, hash);\n\nif (result.valid) {\n    console.log(\"Password matches!\");\n    // Optional (Hash Rotation): Update the stored hash in your database\n    // console.log(\"New hash for rotation:\", result.updateHash);\n} else {\n    console.log(\"Invalid password!\");\n}\n```\n\n## Parameter Guide\n\n### `hash(password, round, length)`\n- `password` *(string)*: The plaintext password to hash. Must not be empty.\n- `round` *(number)*: Sponge permutation rounds. Higher = slower & stronger. Recommended: **24**.\n- `length` *(number)*: Output length in bytes (24 - 99). The resulting hex string length is `length * 2` characters. Recommended: **32**.\n\n### `verify(password, round, hashedPassword)`\n- Returns an object: `{ valid: boolean, updateHash: string | null }`\n- `valid` *(boolean)*: `true` if the password matches the hash.\n- `updateHash` *(string)*: A freshly generated hash. It is highly recommended to replace the stored hash with this new value on every successful login to mitigate credential-stuffing attacks.\n\n## License\nMIT License.\n\n---\n*Developed by Alvin Sudarta - Universitas Bunda Mulia (2026)*\n","readmeFilename":"README.md"}