{"library":"react-native-sha256","title":"Native SHA256/SHA1 Hashing for React Native","description":"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.","language":"javascript","status":"active","last_verified":"Sun Apr 19","install":{"commands":["npm install react-native-sha256"],"cli":null},"imports":["import { sha256 } from 'react-native-sha256';","import { sha256Bytes } from 'react-native-sha256';","import { sha1 } from 'react-native-sha256';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { sha256 } from 'react-native-sha256';\n\n// Hash a simple string\nsha256(\"Hello, checklist.day!\").then(hash => {\n    console.log('SHA256 Hash:', hash);\n}).catch(error => {\n    console.error('Hashing error:', error);\n});\n\n// For hashing byte arrays, prepare the array\nconst messageBytes = new Uint8Array([72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]); // 'Hello World'\nimport { sha256Bytes } from 'react-native-sha256';\nsha256Bytes(Array.from(messageBytes)).then(hash => {\n    console.log('SHA256 Bytes Hash:', hash);\n}).catch(error => {\n    console.error('Hashing bytes error:', error);\n});","lang":"typescript","description":"Demonstrates how to compute SHA256 hashes for both string and byte array inputs.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}