Please provide the following:
- SDK Version: 45.0.0
- Platforms(Android/iOS/web/all): Android/iOS
- Add the appropriate “Tag” based on what Expo library you have a question on.
I’m working with the Node crypto library in my web application and expo-crypto in my app. I need to have the same functionality in both. The value from the Node crypto library is correct but for some reason I’m getting another value with expo-crypto.
Currently the web solution is working as expected.
const randomData = 'XTXpQWATVzlHSp2ZjvmoAfvXYDtT3O1q4SYFIDyPXardJhiLbC/tiw=='; const hashedValue = crypto.createHash('sha512').update(randomData).digest('hex');
The hashed value above is
My expo app solution is not returning the same value as the web solution:
import Crypto from 'expo-crypto' const randomData = 'XTXpQWATVzlHSp2ZjvmoAfvXYDtT3O1q4SYFIDyPXardJhiLbC/tiw=='; const hashedValue = await Crypto.digestStringAsync(Crypto.CryptoDigestAlgorithm.SHA512, randomData);
This hashed value, from
Ideally they would both return the same value, any ideas on what is going on here? I also posted this to stack overflow