itinance / itinance/react-native-fs
How to calculate identical hashes in React Native and Node?
- Dominant language
- C++
- Stars
- 5k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
I'm using `hash` to generate checksums for files before I upload them to AWS S3.
```javascript
RNFS.hash(localUrl, "md5")
```
This seems to work great. Once the file has been uploaded, I need to verify the checksum for the file using Node 10.x (Lambda). I can't seem to get the same checksum using other libraries. For example, with Node's [crypto.createHash](https://nodejs.org/api/crypto.html#crypto_crypto_createhash_algorithm_options):
```javascript
const file = await s3
.getObject({
Bucket,
Key
}).promise()
crypto
.createHash("md5")
.update(file.Body)
.digest("hex");
```
The generated hash does not match what was produced by `react-native-fs`. How do I generate a hash in Node identical to what is produced by `react-native-fs` for the same file?
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.