react-native-sha256 provides performant, native SHA256 and SHA1 hashing capabilities for strings and byte arrays within React Native applications. Leveraging native modules on both iOS and Android, it significantly outperforms JavaScript-only implementations in terms of speed, which is crucial for mobile performance. The current stable version is 1.4.10, with releases occurring sporadically based on maintenance and feature additions. Key differentiators include its native execution, support for both SHA256 and SHA1 (since version 1.3.6), and built-in TypeScript definitions, making it suitable for modern React Native development. While it supports traditional `react-native link` for older projects, it also outlines CocoaPods integration for iOS, aligning with contemporary React Native setups. For file hashing, it suggests integration with `react-native-fs` rather than providing its own implementation.
npm install react-native-sha256Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to compute SHA256 hashes for both string and byte array inputs.
For React Native >=0.60, remove `react-native link`. Ensure `pod install` is run in your `ios/` directory. If auto-linking fails, follow manual linking steps for iOS/Android modules as per React Native documentation.
After adding the package, run `cd ios && pod install` for iOS projects. For older RN versions, run `react-native link react-native-sha256`. Always clear caches (`npm start --reset-cache`) and rebuild native projects.
If you have a `Uint8Array`, convert it to a regular JavaScript array: `sha256Bytes(Array.from(yourUint8Array))`.
Prefer `sha256` over `sha1` for all new implementations where collision resistance is important.
For React Native <0.60: Run `react-native link react-native-sha256`. For React Native >=0.60: Ensure auto-linking is working; navigate to `ios/` and run `pod install`. For Android, ensure Gradle builds correctly. Clean your build caches and rebuild the native project.
Run `cd ios && pod install` to ensure CocoaPods integrates the library. If using manual linking, verify the `.xcodeproj` file is added to your Libraries in Xcode and the target's 'Build Phases' link binary with libraries includes `libRNSha256.a`.
This typically points to the same underlying linking issues as 'Native module RNSha256 not found'. Verify installation steps, clear Metro cache (`npm start --reset-cache`), and perform a clean native build (`cd ios && rm -rf build && pod install && cd .. && npx react-native run-ios` for iOS).
No dependency data recorded yet.