Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hash Produces Incorrect SHA256 for some (perhaps Large?) Files #99

Open
a-ghorbani opened this issue Jan 16, 2025 · 0 comments
Open

hash Produces Incorrect SHA256 for some (perhaps Large?) Files #99

a-ghorbani opened this issue Jan 16, 2025 · 0 comments
Labels
P1 High priority issue.

Comments

@a-ghorbani
Copy link

a-ghorbani commented Jan 16, 2025

Description

RNFS.hash does not produce the correct SHA256 hash for some (perhaps large) files.
The hash calculated by RNFS.hash differs from the expected value computed using standard tools like shasum and matches the hash reported on the file's source page.

note: My testing has been on GGUF files from Hugging Face, which are typically a few GBs in size. I have not faced this issue with smaller files, from my observation it seems they occurs with files around 1 GB or larger.

Steps to Reproduce:

  1. Download the file: Model-7.6B-Q4_K_S.gguf
  2. Place the file in the app's accessible directory (e.g., RNFS.DocumentDirectoryPath)
  3. use await RNFS.hash(filePath, 'sha256'); to get the hash
  4. compare the value either with the reported one on HF page, or shasum -a 256 /PATH/TO/SIMULATOR/DIR/Model-7.6B-Q4_K_S.gguf

Expected Behavior:

The hash returned by RNFS.hash should match the expected SHA256 value: 6d28c300dab7c224f9b34afcca0e0413c985846482f62e49b2cef109f82af926

Actual Behavior:

RNFS.hash returns: 1ba0bd6473b9f7b5a2a355256854ee4345e7abf229361363d745387b4c151958

Additional Information:

RNFS version: 2.30.1
React Native version: 0.76.3
Platform: iOS (Simulator)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 High priority issue.
Projects
None yet
Development

No branches or pull requests

2 participants