-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathpackage.json
20 lines (20 loc) · 3.36 KB
/
package.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
{
"name": "pidcrypt",
"license": "BSD",
"author": {
"email": "[email protected]",
"name": "Nik van der Ploeg"
},
"repository": {
"url": "git+https://github.com/nikvdp/pidcrypt.git",
"type": "git"
},
"readmeFilename": "README.md",
"version": "0.0.33",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"readme": "[Pidcrypt](https://www.pidder.de/pidcrypt/) (JS encryption library) for node.js/browserify\n==========================================================================================\n\nThis is a copy of the [pidCrypt javascript crypto library](https://www.pidder.de/pidcrypt/) with some modifications to make it compatible with node.js and browserify. Pidcrypt submodules are all accessible via `require`, and will automatically pull in any other submodule dependencies if needed.\n\nInstallation\n============\n\n``` bash\nnpm install --save pidcrypt\n```\n\nUsage:\n======\n\n### Encrypting text via AES (CBC)\n\nAES CBC is a relatively easy to use symmetric encryption method that has the added convenience of being compatible with `openssl` (included on almost any *nix machine as well)\n\n``` javascript\n// Require seedrandom.js first to increase randomness for stronger encryption\nrequire(\"pidcrypt/seedrandom\")\n \nvar pidCrypt = require(\"pidcrypt\")\nrequire(\"pidcrypt/aes_cbc\")\n\nvar aes = new pidCrypt.AES.CBC()\n\nvar pw = \"some password\";\nvar encrypted = aes.encryptText(\"some text\", pw); \n\nconsole.log(\"Encrypted text is: '%s'\", encrypted);\n// Encrypted text is: 'U2FsdGVkX19yGT01gBIBMJCEM7cBW6vc3ND06CyKu1w='\n\nvar decrypted = aes.decryptText(encrypted, pw);\n\nconsole.log(\"Original text was: '%s'\", decrypted);\n// Original text was 'some text'\n```\n\nTo perform the same encryption via openssl you'd use:\n\n``` bash\necho \"some text\" | openssl enc -aes-256-cbc -a -pass 'pass:some password'\n```\n\n### Decyrpting text via AES (CBC)\n\n``` javascript\n// Require seedrandom.js first to increase randomness for stronger encryption\nrequire(\"pidcrypt/seedrandom\")\n \nvar pidCrypt = require(\"pidcrypt\")\nrequire(\"pidcrypt/aes_cbc\")\n\nvar aes = new pidCrypt.AES.CBC()\n\nvar pw = \"some password\";\n\nvar encryptedText = 'U2FsdGVkX19yGT01gBIBMJCEM7cBW6vc3ND06CyKu1w=';\n\nvar decrypted = aes.decryptText(encryptedText, pw);\n\nconsole.log(\"Decrypted text is: '%s'\", decrypted);\n// Decrypted text is: 'some text'\n```\n\nTo decrypt this via `openssl` you'd use:\n\n``` bash\necho U2FsdGVkX19yGT01gBIBMJCEM7cBW6vc3ND06CyKu1w= | openssl enc -aes-256-cbc -d -a -pass 'pass:some password'\n```\n\nOther encryption formats\n========================\n\nYou can load any of the modules included with pidcrypt in the same manner as the `aes_cbc` module. For convenience here are all the included encryption/decryption modules:\n\n- `aes_cbc`\n- `aes_ctr`\n- `asn1`\n- `jsbn`\n- `md5`\n- `prng4`\n- `rsa`\n- `sha1`\n- `sha256`\n- `sha512`\n\nYou can use any module in the same manner as above:\n\n``` javascript\n// load pidcrypt\nvar pidCrypt = require(\"pidcrypt\");\n\n// grab your module\nrequire(\"pidcrypt/<your module>\");\n\n// do stuff as per the pidcrypt documentation for that module...\n```\n\nSee documentation on the [pidcrypt site](https://www.pidder.de/pidcrypt/) for more details.\n",
"main": "index.js",
"description": "Node.js / browserify wrapper for the JS encryption libraries"
}