DEV Community

Discussion on: How to generate 11 char hash key for Sms Retriever?

Collapse
khajanizamuddin1 profile image
Khaja Nizamuddin

Hi, I am new to React Native/Expo
I'm implementing just the SMS retrieval code in React Native app following this article:
github.com/Bruno-Furtado/react-nat...

I need to get the 11 char hash key to add it to the end of my sms

So, 1 way to get it is by signing the app with Google (which is the easy way to store my keytool for multiple app I understand) as it requires registration fee to sign up for console
I'm wondering if there's any other way I can get the hash key
I'v run this to generate the keytool:

keytool -genkey -v -keystore app1sms.keystore -alias app1smsKey -keyalg RSA -keysize 2048 -validity 10000

I'm stuck with no clue what to do after this
Can you advise please

Thread Thread
jyotishman profile image
Jyotishman Saikia Author • Edited on

Have you built your app using a signed key? If not you can generate your Keystore using the Android studio just with some clicks.
If you have already generated your Keystore than you can use the below command to generate your 11 digits unique hash key.

keytool -exportcert -alias my_alias -keystore path_to_my_keystore | xxd -p | tr -d "[:space:]" | echo -n my_app_package_name `cat` | shasum -a 256 | tr -d "[:space:]-" | xxd -r -p | base64 | cut -c1-11

Replace

my_alias with your alias name, path_to_my_keystore to the exact path of Keystore file and my_app_package_name with your application package name, eg- com.example

Finally, enter the password and 11 digit unique hash will be generated.

Thread Thread
iampapagray profile image
John Graham

After entering the password, nothing happens. No response and the prompt isn't returned. It seems its just stuck

Thread Thread
appi2393 profile image
Apurva Jain

keytool -exportcert -alias my_alias -keystore path_to_my_keystore | xxd -p | tr -d "[:space:]" | echo -n my_app_package_name 'cat' | shasum -a 256 | tr -d "[:space:]-" | xxd -r -p | base64 | cut -c1-11

Should work fine with above command. cat replaced with 'cat'