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

✨ Add blake3 support #580

Open
2 tasks done
XChikuX opened this issue Jan 8, 2025 · 3 comments
Open
2 tasks done

✨ Add blake3 support #580

XChikuX opened this issue Jan 8, 2025 · 3 comments

Comments

@XChikuX
Copy link

XChikuX commented Jan 8, 2025

What feature or enhancement are you suggesting?

Blake3 is THE modern hashing algorithm out there.

There are plenty of opensource contributions toward blake3.

One such example is: https://github.com/connor4312/blake3

Could we please port it to work with react-native as well. I sorely miss this feature as it would be a great security add one. Especially for tagging images on users' phones directly.

I also use it to make secure HMACs:

async function makeHmac(msg: string, derivedKey: string): Promise<string> {
  const hashFunc = createBLAKE3(256);
  const hmac = await createHMAC(hashFunc, derivedKey);

  hmac.init();
  hmac.update(msg);
  const hmacResult = hmac.digest();

  const token = `Bearer ${hmacResult};${msg}`;
  return token;
}

Thanks!

What Platforms whould this feature/enhancement affect?

iOS, Android

Alternatives/Workarounds

There are no current workarounds except, very messily trying to connect a wasm implementation over react-native-react-bridge.

However, this approach is something I could not even get a basic example working.

Additional information

@salieflewis
Copy link

What do you mean by "tagging images on users' phones directly"?

@XChikuX
Copy link
Author

XChikuX commented Feb 7, 2025

I currently use blake3 for identifying image names in my backend. Whatever file the user uploads undergoes a blake3 hash and the hash is used to retrieve the image from s3.

I'd like to cross verify that the image is indeed it's name. By recomputing the hash on my side.

I know I can change this to SHA256. But I'm looking at bigger files in the future I'd like to tackle the same way.

@salieflewis
Copy link

I currently use blake3 for identifying image names in my backend. Whatever file the user uploads undergoes a blake3 hash and the hash is used to retrieve the image from s3.

I'd like to cross verify that the image is indeed it's name. By recomputing the hash on my side.

I know I can change this to SHA256. But I'm looking at bigger files in the future I'd like to tackle the same way.

Ahh cool. We do similar things for https://river.site/

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

No branches or pull requests

2 participants