{"id":21071783,"url":"https://github.com/akshayitzme/rn-crypto-js","last_synced_at":"2025-05-16T05:31:55.763Z","repository":{"id":63278184,"uuid":"565993264","full_name":"akshayitzme/rn-crypto-js","owner":"akshayitzme","description":"CryptoJS for React Native, is a collection of standard and secure cryptographic algorithms implemented in JavaScript using best practices and patterns. ","archived":false,"fork":false,"pushed_at":"2023-05-22T05:34:04.000Z","size":83,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-03T20:51:15.506Z","etag":null,"topics":["cryptojs","encryption-decryption","hashing","react-native"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/rn-crypto-js","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/akshayitzme.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-14T18:51:51.000Z","updated_at":"2024-09-27T03:59:40.000Z","dependencies_parsed_at":"2024-11-19T19:04:36.558Z","dependency_job_id":null,"html_url":"https://github.com/akshayitzme/rn-crypto-js","commit_stats":{"total_commits":2,"total_committers":1,"mean_commits":2.0,"dds":0.0,"last_synced_commit":"54184c81d8c762408768916825257712b2e39d60"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayitzme%2Frn-crypto-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayitzme%2Frn-crypto-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayitzme%2Frn-crypto-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akshayitzme%2Frn-crypto-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akshayitzme","download_url":"https://codeload.github.com/akshayitzme/rn-crypto-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254474378,"owners_count":22077269,"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":["cryptojs","encryption-decryption","hashing","react-native"],"created_at":"2024-11-19T18:54:12.441Z","updated_at":"2025-05-16T05:31:55.399Z","avatar_url":"https://github.com/akshayitzme.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React Native CryptoJS\n\u003e 📢 : Not Actively Maintained \n\nReact Native JavaScript Library of crypto-js.\n\n## Install\n\n```bash\nyarn add rn-crypto-js\n```\n\n## List of Algorithms\n\n| Hashing   \t            | HMAC           \t                | CIPHERS   \t            | PBKDF2 \t            |\n|-------------------------- |---------------------------------- |-------------------------- |---------------------- |\n| [MD5](#MD5)  \t            | [HMAC-MD5](#HMAC-MD5)             | [AES](#AES)  \t            | [PBKDF2](#PBKDF2) \t|\n| [SHA1](#SHA1)             | [HMAC-SHA1](#HMAC-SHA1)           | [DES](#DES)  \t            |        \t            |\n| [SHA256](#SHA256)         | [HMAC-SHA256](#HMAC-SHA256)       | [TripleDES](#TripleDES) \t|        \t            |\n| [SHA224](#SHA224)         | [HMAC-SHA224](#HMAC-SHA224)       | [RC4](#RC4)              \t|        \t            |\n| [SHA512](#SHA512)         | [HMAC-SHA512](#HMAC-SHA512)       | [RC4Drop](#RC4Drop)   \t  |        \t            |\n| [SHA384](#SHA384)         | [HMAC-SHA384](#HMAC-SHA384)       | [RABBIT](#RABBIT)     \t  |        \t            |\n| [SHA3](#SHA3)             | [HMAC-SHA3](#HMAC-SHA3)           |           \t              |        \t            |\n| [RIPEMD160](#RIPEMD160) \t| [HMAC-RIPEMD160](#HMAC-RIPEMD160) |           \t              |        \t            |\n\n\n#### Plain text encryption\n\n```javascript\nimport CryptoJS from \"rn-crypto-js\";\n\n// Encrypt\nconst ciphertext = CryptoJS.AES.encrypt('my message', 'secret key 123').toString();\n\n// Decrypt\nconst decryptedData  = CryptoJS.AES.decrypt(ciphertext, 'secret key 123').toString(CryptoJS.enc.Utf8);\nconsole.log(decryptedData); // 'my message'\n```\n\n#### Object encryption\n\n```javascript\nimport CryptoJS from \"rn-crypto-js\";\nconst data = [{id: 1}, {id: 2}]\n\n// Encrypt\nconst ciphertext = CryptoJS.AES.encrypt(JSON.stringify(data), 'secret key 123').toString();\n\n// Decrypt\nconst decryptedString  = CryptoJS.AES.decrypt(ciphertext, 'secret key 123').toString(CryptoJS.enc.Utf8);\nconst decryptedData = JSON.parse(decryptedString);\nconsole.log(decryptedData); // [{id: 1}, {id: 2}]\n```\n\n## Hashing\n### MD5\nMD5 is a widely used hash function. It's been used in a variety of security applications and is also commonly used to check the integrity of files. Though, MD5 is not collision resistant, and it isn't suitable for applications like SSL certificates or digital signatures that rely on this property.\n\n```javascript\nconst hash = CryptoJS.MD5(\"Message\").toString();\n```\n\n### SHA1\nThe SHA hash functions were designed by the National Security Agency (NSA). SHA-1 is the most established of the existing SHA hash functions, and it's used in a variety of security applications and protocols. Though, SHA-1's collision resistance has been weakening as new attacks are discovered or improved.\n\n```javascript\nconst hash = CryptoJS.SHA1(\"Message\").toString();\n```\n\n### SHA256\nSHA-256 is one of the four variants in the SHA-2 set. It isn't as widely used as SHA-1, though it appears to provide much better security.\n\n```javascript\nconst hash = CryptoJS.SHA256(\"Message\").toString();\n```\n### SHA224\n```javascript\nconst hash = CryptoJS.SHA224(\"Message\").toString();\n```\n\n### SHA384\n```javascript\nconst hash = CryptoJS.SHA384(\"Message\").toString();\n```\n\n### SHA512\n```javascript\nconst hash = CryptoJS.SHA512(\"Message\").toString();\n```\n\n### SHA3\nSHA-3 is the winner of a five-year competition to select a new cryptographic hash algorithm where 64 competing designs were evaluated.\n```javascript\nconst hash = CryptoJS.SHA3(\"Message\").toString();\n```\n\n### RIPEMD160\n```javascript\nconst hash = CryptoJS.RIPEMD160(\"Message\").toString();\n```\n\n## HMAC\n### HMAC-MD5\n```javascript\nconst hash = CryptoJS.MD5(\"Message\").toString();\n```\n\n### HMAC-SHA1\n```javascript\nconst hash = CryptoJS.SHA1(\"Message\").toString();\n```\n\n### HMAC-SHA256\n```javascript\nconst hash = CryptoJS.SHA256(\"Message\").toString();\n```\n### HMAC-SHA224\n```javascript\nconst hash = CryptoJS.SHA224(\"Message\").toString();\n```\n\n### HMAC-SHA384\n```javascript\nconst hash = CryptoJS.SHA384(\"Message\").toString();\n```\n\n### HMAC-SHA512\n```javascript\nconst hash = CryptoJS.SHA512(\"Message\").toString();\n```\n\n### HMAC-SHA3\n```javascript\nconst hash = CryptoJS.SHA3(\"Message\").toString();\n```\n\n### HMAC-RIPEMD160\n```javascript\nconst hash = CryptoJS.HMACRIPEMD160(\"Message\").toString();\n```\n\n## Ciphers\n\n### AES\nThe Advanced Encryption Standard (AES) is a U.S. Federal Information Processing Standard (FIPS). It was selected after a 5-year process where 15 competing designs were evaluated.\n\n```javascript\nconst encrypted = CryptoJS.AES.encrypt(\"Message\", \"5ecret\").toString();\n​\nconst decrypted = CryptoJS.AES.decrypt(encrypted, \"5ecret\").toString(CryptoJS.enc.Utf8);\n```\n\n### DES\nDES is a previously dominant algorithm for encryption, and was published as an official Federal Information Processing Standard (FIPS). DES is now considered to be insecure due to the small key size.\n\n```javascript\nconst encrypted = CryptoJS.DES.encrypt(\"Message\", \"5ecret\").toString();\n​\nconst decrypted = CryptoJS.DES.decrypt(encrypted, \"5ecret\").toString(CryptoJS.enc.Utf8);\n```\n\n### TripleDES\nTriple DES applies DES three times to each block to increase the key size. The algorithm is believed to be secure in this form.\n\n```javascript\nconst encrypted = CryptoJS.TripleDES.encrypt(\"Message\", \"5ecret\").toString();\n​\nconst decrypted = CryptoJS.TripleDES.decrypt(encrypted, \"5ecret\").toString(CryptoJS.enc.Utf8);\n```\n\n### RC4\nRC4 is a widely-used stream cipher. It's used in popular protocols such as SSL and WEP. Although remarkable for its simplicity and speed, the algorithm's history doesn't inspire confidence in its security.\n\n```javascript\nconst encrypted = CryptoJS.RC4.encrypt(\"Message\", \"5ecret\").toString();\n​\nconst decrypted = CryptoJS.RC4.decrypt(encrypted, \"5ecret\").toString(CryptoJS.enc.Utf8);\n```\n\n### RC4Drop\nIt was discovered that the first few bytes of keystream are strongly non-random and leak information about the key. We can defend against this attack by discarding the initial portion of the keystream. This modified algorithm is traditionally called RC4-Drop.\n\n```javascript\nconst encrypted = CryptoJS.RC4Drop.encrypt(\"Message\", \"5ecret\").toString();\n​\nconst decrypted = CryptoJS.RC4Drop.decrypt(encrypted, \"5ecret\").toString(CryptoJS.enc.Utf8);\n```\n\n### Rabbit\nRabbit is a high-performance stream cipher and a finalist in the eSTREAM Portfolio. It is one of the four designs selected after a 3 1/2-year process where 22 designs were evaluated.\n\n```javascript\nconst encrypted = CryptoJS.Rabbit.encrypt(\"Message\", \"5ecret\").toString();\n​\nconst decrypted = CryptoJS.Rabbit.decrypt(encrypted, \"5ecret\").toString(CryptoJS.enc.Utf8);\n```\n\n## PBKDF2\nPBKDF2 is a password-based key derivation function. In many applications of cryptography, user security is ultimately dependent on a password, and because a password usually can't be used directly as a cryptographic key, some processing is required.\n\n```javascript\nconst salt = CryptoJS.lib.WordArray.random(128 / 8);\nconst key128Bits = CryptoJS.PBKDF2(\"Secret Passphrase\", salt, {\n  keySize: 128 / 32\n}).toString();\n\nconst key256Bits = CryptoJS.PBKDF2(\"Secret Passphrase\", salt, {\n  keySize: 256 / 32\n}).toString();\n\nconst key512Bits = CryptoJS.PBKDF2(\"Secret Passphrase\", salt, {\n  keySize: 512 / 32\n}).toString();\n\nconst key512Bits1000Iterations = CryptoJS.PBKDF2(\"Secret Passphrase\", salt, {\n  keySize: 512 / 32,\n  iterations: 1000\n}).toString();\n```\n\n\n## Contributing\nCheck the issues and pull requests to see if the idea or bug you want to share about is already present. If you don't see it, do one of the following:\n\n* If it is a small change, just fork the project and create a pull request.\n* If it is major, start by opening an issue.\n\n\n## License\nPlease see [LICENSE](LICENSE) for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshayitzme%2Frn-crypto-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakshayitzme%2Frn-crypto-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakshayitzme%2Frn-crypto-js/lists"}