{"id":17350313,"url":"https://github.com/lamnguyen17/react-native-crypto-algorithm","last_synced_at":"2026-01-28T12:09:10.411Z","repository":{"id":257820407,"uuid":"870570797","full_name":"LamNguyen17/react-native-crypto-algorithm","owner":"LamNguyen17","description":"Native Module using Kotlin \u0026 Swift for React-Native","archived":false,"fork":false,"pushed_at":"2024-10-18T08:40:19.000Z","size":1467,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-18T08:17:21.165Z","etag":null,"topics":["corountines-flows","cryptoswift","kotlin-android","kotlin-coroutines","native-modules","react-native","reactive-programming","rxswift","swift-ios"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/LamNguyen17.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","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":"2024-10-10T09:29:11.000Z","updated_at":"2024-10-17T10:04:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"7fe4e39e-6c90-4b8b-93c5-a7e180ea331b","html_url":"https://github.com/LamNguyen17/react-native-crypto-algorithm","commit_stats":null,"previous_names":["lamnguyen17/react-native-crypto-algorithm"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/LamNguyen17/react-native-crypto-algorithm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LamNguyen17%2Freact-native-crypto-algorithm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LamNguyen17%2Freact-native-crypto-algorithm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LamNguyen17%2Freact-native-crypto-algorithm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LamNguyen17%2Freact-native-crypto-algorithm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LamNguyen17","download_url":"https://codeload.github.com/LamNguyen17/react-native-crypto-algorithm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LamNguyen17%2Freact-native-crypto-algorithm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268311326,"owners_count":24230334,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["corountines-flows","cryptoswift","kotlin-android","kotlin-coroutines","native-modules","react-native","reactive-programming","rxswift","swift-ios"],"created_at":"2024-10-15T17:06:29.904Z","updated_at":"2026-01-28T12:09:10.371Z","avatar_url":"https://github.com/LamNguyen17.png","language":"Swift","readme":"# react-native-crypto-algorithm\n\n[![](https://img.shields.io/badge/yarn-v1.0.2-blue)](https://www.npmjs.com/package/react-native-crypto-algorithm)\n[![](https://img.shields.io/badge/native_language-Kotlin_\u0026_Swift-green)](https://www.npmjs.com/package/react-native-crypto-algorithm)\n[![](https://img.shields.io/badge/size-72.7_kB-red)](https://www.npmjs.com/package/react-native-crypto-algorithm)\n[![](https://img.shields.io/badge/license-MIT-8A2BE2)](https://github.com/LamNguyen17/react-native-crypto-algorithm/blob/master/LICENSE)\n[![](https://img.shields.io/badge/author-Forest_Nguyen-f59642)](https://github.com/LamNguyen17)\n\n## Installation\n```sh\nnpm install react-native-crypto-algorithm\n```\nor\n```sh\nyarn add react-native-crypto-algorithm\n```\n\n### Installation (iOS)\n\n##### Using CocoaPods (React Native 0.60 and higher)\n\n```sh\ncd ios\npod install\n```\n\n##### Using React Native Link (React Native 0.59 and lower)\n\nRun `react-native link react-native-crypto-algorithm` after which you should be able to use this library on iOS.\n\n### Installation (Android)\n\n##### React Native 0.60 and higher\n\n-   Linking is done automatically\n\n##### Using React Native Link (React Native 0.59 and lower)\n\n-   In `android/settings.gradle`\n\n```gradle\n...\ninclude ':react-native-crypto-algorithm'\nproject(':react-native-crypto-algorithm').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-crypto-algorithm/android')\n```\n\n-   In `android/app/build.gradle`\n\n```gradle\n...\ndependencies {\n    ...\n    compile project(':react-native-crypto-algorithm')\n}\n```\n-   register module (in MainApplication.kt)\n\n```kt\n......\nimport com.cryptoalgorithm.CryptoAlgorithmPackage;\n......\n\noverride fun getPackages(): List\u003cReactPackage\u003e =\n  PackageList(this).packages.apply {\n    add(CryptoAlgorithmPackage());\n  }\n```\n\n---\n## Usage\n### Methods\n#### 🚀 AES\n- Custom 'secretKey' -\u003e maximum 32 characters\n  . Custom 'ivKey' (optional) -\u003e maximum 16 characters\n- 🍁 `encryptAES(value: string, secretKey: string, ivKey?: string)`\n- 🍁 `decryptAES(value: string, secretKey: string, ivKey?: string)`\n```js\nimport Crypto from 'react-native-crypto-algorithm';\n\n// Encrypt\nlet encryptData = await Crypto.encryptAES('my message', 'my private key', 'my iv key(optional maximum 16 characters)');\n\n// Decrypt\nlet decryptData = await Crypto.decryptAES(encryptData, 'my private key', 'my iv key(optional maximum 16 characters)');\n```\n\n#### 🚀 SHA256\n- 🍁 `hashSHA256(value: string)`\n```js\nimport Crypto from 'react-native-crypto-algorithm';\n\n// Hash SHA256\nlet hashData = await Crypto.hashSHA256('my hash data');\n```\n\n#### 🚀 RSA\n- 🍁 `genRSAKeyPair()`\n- 🍁 `encryptRSA(value: string, publicKey: string)`\n- 🍁 `decryptRSA(value: string, privateKey: string)`\n```js\nimport Crypto from 'react-native-crypto-algorithm';\n\n// Generate RSA Key Pair\nlet keyPair = await Crypto.genRSAKeyPair();\n\n// Encrypt RSA\nlet encryptData = await Crypto.encryptRSA('my message', keyPair.publicKey);\n\n// Decrypt RSA\nlet decryptData = await Crypto.decryptRSA(encryptData, keyPair.privateKey);\n```\n\n#### 🚀 HMAC / HMAC_AES\n- 🍁 `genHmacSecretKey() -\u003e use with all HMAC \u0026 HMAC_AES`\n- 🍁 `encryptHmacAes(value: string, publicKey: string) -\u003e use only for HMAC_AES`\n- 🍁 `decryptHmacAes(value: string, privateKey: string) -\u003e use only for HMAC_AES`\n- 🍁 `verifyHmac(value: string, privateKey: string) -\u003e use only for HMAC`\n```js\nimport Crypto from 'react-native-crypto-algorithm';\n\n// Generate HMAC \u0026 HMAC_AES\nlet genHmacSecretKey = await Crypto.genHmacSecretKey();\n\n// Encrypt HMAC_AES\nlet encryptData = await Crypto.encryptHmacAes('my message', genHmacSecretKey);\n\n// Decrypt HMAC_AES\nlet decryptData = await Crypto.decryptHmacAes(encryptData, genHmacSecretKey);\n\n// VerifyHmac HMAC\nlet verifyHmacData: boolean = await Crypto.verifyHmac('my message', genHmacSecretKey);\n```\n\n---\n## API\n### List of Algorithms\n- [x] ```AES(Advanced Encryption Standard)```\n- [x] ```SHA-256 (Secure Hash Algorithm)```\n- [x] ```RSA (Rivest-Shamir-Adleman)```\n- [ ] ```ChaCha20```\n- [ ] ```Blowfish```\n- [x] ```HMAC (Hash-based Message Authentication Code)```\n- [ ] ```PBKDF2 (Password-Based Key Derivation Function 2)```\n- [ ] ```ECC (Elliptic Curve Cryptography)```\n- [ ] ```Scrypt```\n- [ ] ```XChaCha20-Poly1305```\n---\n## Author\n    Forest Nguyen\n    Email: devlamnt176@gmail.com\n---\n## License\n    MIT License\n    Copyright (c) 2024 Forest Nguyen\n---\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamnguyen17%2Freact-native-crypto-algorithm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flamnguyen17%2Freact-native-crypto-algorithm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flamnguyen17%2Freact-native-crypto-algorithm/lists"}