{"_id":"@alt-javascript/jasypt","_rev":"3-a7f9c4410a39009cac78c02ed3dd294f","name":"@alt-javascript/jasypt","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@alt-javascript/jasypt","version":"1.0.0","keywords":["jasypt","pbewithmd5anddes","crypto","encrypt","decrypt","digest"],"author":{"name":"Craig Parravicini"},"license":"MIT","_id":"@alt-javascript/jasypt@1.0.0","maintainers":[{"name":"craigparra","email":"craigparra@gmail.com"}],"contributors":[{"name":"Ricky泽阳","email":"mail@zhoumq.cn"}],"homepage":"https://github.com/alt-javascript/jasypt#readme","bugs":{"url":"https://github.com/alt-javascript/jasypt/issues"},"bin":{"jasypt":"bin/jasypt.js"},"tap":{"lines":90,"branches":65,"functions":90,"statements":90},"dist":{"shasum":"836a961054dba0a0a03b96e27b434bfab0ac0a88","tarball":"https://registry.npmjs.org/@alt-javascript/jasypt/-/jasypt-1.0.0.tgz","fileCount":9,"integrity":"sha512-9hC85gdSR2FsFW/jdHC6NXimT3akV2Vl6i3axeVww0Rs2jWfHzb/Wvw/JEHG8QXI9dzCd3aOsAeCxv48igIT0w==","signatures":[{"sig":"MEQCIF/tOqJhju5GHpEYB3ZrKjwMpbhoI/6cmUdJyUG6niFJAiBpLTwiEmyPITR41eYlPGNP28lDotWaDubTWq8qxcXFdw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29221},"main":"index.js","type":"module","gitHead":"2c0fccc7fb9ccac7cb090c9db92f351178ea0621","scripts":{"ci":"tap -j4 test/* --coverage","cov":"tap -j4 test/* --coverage-report=html","test":"tap -j4 test/*","benchmark":"node ./benchmark/jasypt.js"},"_npmUser":{"name":"craigparra","email":"craigparra@gmail.com"},"repository":{"url":"git+https://github.com/alt-javascript/jasypt.git","type":"git"},"_npmVersion":"11.11.0","description":"Jasypt (Java) clone for Node.js","directories":{},"_nodeVersion":"24.14.0","dependencies":{"des.js":"^1.1.0","commander":"^2.20.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^21.6.2","benchmark":"^2.1.4","beautify-benchmark":"^0.2.4"},"_npmOperationalInternal":{"tmp":"tmp/jasypt_1.0.0_1773099023914_0.4780860980178294","host":"s3://npm-registry-packages-npm-production"}},"1.0.1":{"name":"@alt-javascript/jasypt","version":"1.0.1","keywords":["jasypt","pbewithmd5anddes","crypto","encrypt","decrypt","digest"],"author":{"name":"Craig Parravicini"},"license":"MIT","_id":"@alt-javascript/jasypt@1.0.1","maintainers":[{"name":"craigparra","email":"craigparra@gmail.com"}],"contributors":[{"name":"Ricky泽阳","email":"mail@zhoumq.cn"}],"homepage":"https://github.com/alt-javascript/jasypt#readme","bugs":{"url":"https://github.com/alt-javascript/jasypt/issues"},"bin":{"jasypt":"bin/jasypt.js"},"tap":{"lines":90,"branches":65,"functions":90,"statements":90},"dist":{"shasum":"8d21dec4b8ff1f288d765a99921d48f9d7cacae8","tarball":"https://registry.npmjs.org/@alt-javascript/jasypt/-/jasypt-1.0.1.tgz","fileCount":9,"integrity":"sha512-T7D9RGKLYzMLYJcsZnT/tEo+EdvIsn/AX4/3+kZoovCjcdvKV3BylasIUjBH1X5uTu9V/8WReuQeTLID4Bm/+w==","signatures":[{"sig":"MEQCIFc1/B4ZMyay0X64w9faTPduPFfYf5bUh39KG2X/vxo/AiBPE2d+I4fbfo5avGTts7EwV1XJxI2ExDs3IOsMXLzObg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29590},"main":"index.js","type":"module","gitHead":"bc7a69f2884b6e01b95ac0cf712239ab845d1472","scripts":{"ci":"tap -j4 test/* --coverage","cov":"tap -j4 test/* --coverage-report=html","test":"tap -j4 test/*","benchmark":"node ./benchmark/jasypt.js"},"_npmUser":{"name":"craigparra","email":"craigparra@gmail.com"},"repository":{"url":"git+https://github.com/alt-javascript/jasypt.git","type":"git"},"_npmVersion":"11.11.0","description":"Jasypt (Java) clone for Node.js","directories":{},"_nodeVersion":"24.14.0","dependencies":{"des.js":"^1.1.0","commander":"^2.20.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^21.6.2","benchmark":"^2.1.4","beautify-benchmark":"^0.2.4"},"_npmOperationalInternal":{"tmp":"tmp/jasypt_1.0.1_1773117251935_0.29624474234069265","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@alt-javascript/jasypt","version":"1.0.2","description":"Jasypt (Java) clone for Node.js","type":"module","main":"index.js","bin":{"jasypt":"bin/jasypt.js"},"scripts":{"test":"tap -j4 test/*","ci":"tap -j4 test/* --coverage","cov":"tap -j4 test/* --coverage-report=html","benchmark":"node ./benchmark/jasypt.js"},"repository":{"type":"git","url":"git+https://github.com/alt-javascript/jasypt.git"},"keywords":["jasypt","pbewithmd5anddes","crypto","encrypt","decrypt","digest"],"author":{"name":"Craig Parravicini"},"contributors":[{"name":"Ricky泽阳","email":"mail@zhoumq.cn"}],"publishConfig":{"registry":"https://registry.npmjs.org/","access":"public"},"bugs":{"url":"https://github.com/alt-javascript/jasypt/issues"},"homepage":"https://github.com/alt-javascript/jasypt#readme","license":"MIT","devDependencies":{"beautify-benchmark":"^0.2.4","benchmark":"^2.1.4","tap":"^21.6.2"},"tap":{"statements":90,"branches":65,"functions":90,"lines":90},"dependencies":{"commander":"^2.20.0","des.js":"^1.1.0"},"gitHead":"3ea408d51a75656e72cae5565510bb7bcfafb4ec","_id":"@alt-javascript/jasypt@1.0.2","_nodeVersion":"24.14.0","_npmVersion":"11.12.0","dist":{"integrity":"sha512-ld77TMBbR6XjVBChI9p8v6rQf8Lo9Zw42nFID8IqBqvIkxaWAIjfFbga0UWG4kjbwffH6WSQAjIj9UWLdVaZsw==","shasum":"09188a72c83a10ac91c35f01137de7e11994d688","tarball":"https://registry.npmjs.org/@alt-javascript/jasypt/-/jasypt-1.0.2.tgz","fileCount":9,"unpackedSize":30855,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDpQrvj88Bnhaw6VKkHeEpTQViG20rrRPIrE72b4OMwewIhAKLUoDGqk3vX2NGID/MiNvHe/HxWvBEPq28urTAWyNJs"}]},"_npmUser":{"name":"craigparra","email":"craigparra@gmail.com"},"directories":{},"maintainers":[{"name":"craigparra","email":"craigparra@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/jasypt_1.0.2_1774061907482_0.676074554533235"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-09T23:30:23.801Z","modified":"2026-03-21T02:58:27.767Z","1.0.0":"2026-03-09T23:30:24.064Z","1.0.1":"2026-03-10T04:34:12.092Z","1.0.2":"2026-03-21T02:58:27.627Z"},"bugs":{"url":"https://github.com/alt-javascript/jasypt/issues"},"author":{"name":"Craig Parravicini"},"license":"MIT","homepage":"https://github.com/alt-javascript/jasypt#readme","keywords":["jasypt","pbewithmd5anddes","crypto","encrypt","decrypt","digest"],"repository":{"type":"git","url":"git+https://github.com/alt-javascript/jasypt.git"},"description":"Jasypt (Java) clone for Node.js","contributors":[{"name":"Ricky泽阳","email":"mail@zhoumq.cn"}],"maintainers":[{"name":"craigparra","email":"craigparra@gmail.com"}],"readme":"# @alt-javascript/jasypt\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][build-image]][build-url]\n[![Downloads/month][downloads-month-image]][download-url]\n[![Total downloads][downloads-image]][download-url]\n\nA Node.js implementation of Java's [Jasypt](http://www.jasypt.org/) password-based encryption and digest utilities. Interoperable with Spring Boot applications that use `ENC(...)` encrypted configuration values.\n\n## Quick Start\n\n```sh\nnpm install @alt-javascript/jasypt\n```\n\n```js\nimport Jasypt from '@alt-javascript/jasypt';\n\nconst jasypt = new Jasypt();\n\n// Encrypt and decrypt\nconst encrypted = jasypt.encrypt('admin', 'mySecretKey');\nconst decrypted = jasypt.decrypt(encrypted, 'mySecretKey');\n// decrypted === 'admin'\n```\n\n## Installation\n\n```sh\nnpm install @alt-javascript/jasypt\n```\n\nOr install globally for the CLI:\n\n```sh\nnpm install -g @alt-javascript/jasypt\n```\n\nRequires Node.js 18 or later.\n\n## API\n\n### `Jasypt`\n\nThe main class provides high-level encrypt, decrypt, and digest operations.\n\n```js\nimport Jasypt from '@alt-javascript/jasypt';\n\nconst jasypt = new Jasypt();\n```\n\n#### `jasypt.encrypt(message, password [, algorithm [, iterations [, salt]]])`\n\nEncrypts a plaintext string. Returns a base64-encoded ciphertext with the salt prepended.\n\n```js\njasypt.encrypt('admin', 'secret');\n// => 'nsbC5r0ymz740/aURtuRWw=='\n\njasypt.encrypt('admin', 'secret', 'PBEWITHHMACSHA256ANDAES_256');\n// => 'K3q8z...' (AES-256-CBC ciphertext)\n```\n\n#### `jasypt.decrypt(encryptedMessage, password [, algorithm [, iterations]])`\n\nDecrypts a base64-encoded ciphertext. The salt is extracted from the ciphertext automatically.\n\n```js\njasypt.decrypt('nsbC5r0ymz740/aURtuRWw==', 'secret');\n// => 'admin'\n```\n\nThrows an error if the password is wrong or the ciphertext is corrupted.\n\n#### `jasypt.digest(message [, salt [, iterations [, algorithm]]])`\n\nProduces a one-way hash. Returns base64-encoded salt + digest bytes.\n\n```js\nconst hash = jasypt.digest('admin');\n```\n\n#### `jasypt.matches(message, storedDigest [, salt [, iterations [, algorithm]]])`\n\nVerifies a plaintext message against a stored digest. Uses constant-time comparison.\n\n```js\nconst hash = jasypt.digest('admin');\njasypt.matches('admin', hash);  // => true\njasypt.matches('wrong', hash);  // => false\n```\n\n### `Encryptor`\n\nLow-level class for direct control over encryption parameters.\n\n```js\nimport Jasypt from '@alt-javascript/jasypt';\nconst { Encryptor } = Jasypt;\n\nconst enc = new Encryptor({\n  password: 'secret',\n  algorithm: 'PBEWITHHMACSHA256ANDAES_256',\n  iterations: 2000,\n});\n\nconst ciphertext = enc.encrypt('admin', 'secret');\nconst plaintext  = enc.decrypt(ciphertext, 'secret');\n```\n\n### `Digester`\n\nLow-level class for direct control over digest parameters.\n\n```js\nimport Jasypt from '@alt-javascript/jasypt';\nconst { Digester } = Jasypt;\n\nconst dig = new Digester({ algorithm: 'SHA-512' });\ndig.setIterations(5000);\ndig.setSaltSize(16);\n\nconst hash    = dig.digest('admin');\nconst isMatch = dig.matches('admin', hash); // => true\n```\n\n## CLI\n\n```\nUsage: jasypt [options] [command]\n\nCommands:\n  encrypt|enc <msg>            Encrypt a plaintext message\n  decrypt|dec <msg>            Decrypt an encrypted message\n  digest|dig <msg>             One-way digest (hash) a message\n  matches|match <msg> <stored> Verify a message against a stored digest\n\nOptions:\n  -v, --version  Output the version number\n  -h, --help     Output usage information\n```\n\n### Encrypt and Decrypt\n\n```sh\njasypt encrypt -p mySecretKey admin\n# => nsbC5r0ymz740/aURtuRWw==\n\njasypt decrypt -p mySecretKey nsbC5r0ymz740/aURtuRWw==\n# => admin\n\n# Use a different algorithm\njasypt encrypt -p mySecretKey -a PBEWITHHMACSHA256ANDAES_256 admin\n```\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `-p, --password <pwd>` | | Secret key (required) |\n| `-a, --algorithm <algo>` | `PBEWITHMD5ANDDES` | Encryption algorithm |\n\n### Digest and Verify\n\n```sh\njasypt digest admin\n# => base64-encoded hash\n\njasypt matches admin 'stored-hash-here'\n# => true or false\n\n# Custom algorithm, iterations, and salt size\njasypt digest -a SHA-512 -i 500 -s 16 admin\n```\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `-a, --algorithm <algo>` | `SHA-256` | Digest algorithm |\n| `-i, --iterations <n>` | `1000` | Hash iterations |\n| `-s, --salt-size <n>` | `8` | Salt size in bytes |\n\n## Supported Algorithms\n\n### Encryption\n\n| Algorithm | Type | Description |\n|-----------|------|-------------|\n| `PBEWITHMD5ANDDES` | PBE1 | MD5 KDF + DES-CBC (default) |\n| `PBEWITHMD5ANDTRIPLEDES` | PBE1 | MD5 KDF + 3DES-CBC |\n| `PBEWITHSHA1ANDDESEDE` | PBE1 | SHA-1 KDF + 3DES-CBC |\n| `PBEWITHSHA1ANDRC2_128` | PBE1 | SHA-1 KDF + RC2-CBC 128-bit |\n| `PBEWITHSHA1ANDRC2_40` | PBE1 | SHA-1 KDF + RC2-CBC 40-bit |\n| `PBEWITHSHA1ANDRC4_128` | PBE1 | SHA-1 KDF + RC4 128-bit |\n| `PBEWITHSHA1ANDRC4_40` | PBE1 | SHA-1 KDF + RC4 40-bit |\n| `PBEWITHHMACSHA1ANDAES_128` | PBE2 | PBKDF2-SHA1 + AES-128-CBC |\n| `PBEWITHHMACSHA1ANDAES_256` | PBE2 | PBKDF2-SHA1 + AES-256-CBC |\n| `PBEWITHHMACSHA224ANDAES_128` | PBE2 | PBKDF2-SHA224 + AES-128-CBC |\n| `PBEWITHHMACSHA224ANDAES_256` | PBE2 | PBKDF2-SHA224 + AES-256-CBC |\n| `PBEWITHHMACSHA256ANDAES_128` | PBE2 | PBKDF2-SHA256 + AES-128-CBC |\n| `PBEWITHHMACSHA256ANDAES_256` | PBE2 | PBKDF2-SHA256 + AES-256-CBC |\n| `PBEWITHHMACSHA384ANDAES_128` | PBE2 | PBKDF2-SHA384 + AES-128-CBC |\n| `PBEWITHHMACSHA384ANDAES_256` | PBE2 | PBKDF2-SHA384 + AES-256-CBC |\n| `PBEWITHHMACSHA512ANDAES_128` | PBE2 | PBKDF2-SHA512 + AES-128-CBC |\n| `PBEWITHHMACSHA512ANDAES_256` | PBE2 | PBKDF2-SHA512 + AES-256-CBC |\n| `PBEWITHHMACSHA512/224ANDAES_128` | PBE2 | PBKDF2-SHA512/224 + AES-128-CBC |\n| `PBEWITHHMACSHA512/224ANDAES_256` | PBE2 | PBKDF2-SHA512/224 + AES-256-CBC |\n| `PBEWITHHMACSHA512/256ANDAES_128` | PBE2 | PBKDF2-SHA512/256 + AES-128-CBC |\n| `PBEWITHHMACSHA512/256ANDAES_256` | PBE2 | PBKDF2-SHA512/256 + AES-256-CBC |\n\n**PBE1** algorithms use an iterative MD5/SHA-1 KDF (EVP_BytesToKey-style) with an 8-byte salt. RC2 and RC4 variants require the OpenSSL legacy provider.\n\n**PBE2** algorithms use PBKDF2 with a 16-byte salt and a random 16-byte IV stored alongside the ciphertext.\n\n### Digest\n\n| Algorithm | Notes |\n|-----------|-------|\n| `MD5` | |\n| `SHA-1` | |\n| `SHA-224` | |\n| `SHA-256` | Default |\n| `SHA-384` | |\n| `SHA-512` | |\n| `SHA-512/224` | |\n| `SHA-512/256` | |\n| `SHA3-224` | |\n| `SHA3-256` | |\n| `SHA3-384` | |\n| `SHA3-512` | |\n| `MD2` | Requires OpenSSL legacy provider |\n\n`Digester.SUPPORTED_ALGORITHMS` reflects only algorithms available in the current OpenSSL build.\n\n## Acknowledgements\n\nThis project is a fork of [jasypt](https://www.npmjs.com/package/jasypt) by [Ricky](https://github.com/rickyes/jasypt), updated for Node.js 18+ (OpenSSL 3.0 compatibility), with additional algorithms, digest support, and an improved CLI.\n\n## License\n\n[MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/%40alt-javascript%2Fjasypt.svg?style=flat-square\n[npm-url]: https://www.npmjs.com/package/@alt-javascript/jasypt\n[build-image]: https://github.com/alt-javascript/jasypt/actions/workflows/node.js.yml/badge.svg?branch=main\n[build-url]: https://github.com/alt-javascript/jasypt/actions/workflows/node.js.yml\n[downloads-month-image]: https://img.shields.io/npm/dm/%40alt-javascript%2Fjasypt.svg?style=flat-square\n[download-url]: https://www.npmjs.com/package/@alt-javascript/jasypt\n[downloads-image]: https://img.shields.io/npm/dt/%40alt-javascript%2Fjasypt.svg\n","readmeFilename":"README.md"}