Keytool generates 32 character long key hash instead of 28

try normal cmd prompt or use git bash command prompt it will generate 28 characters long string. do not use Windows PowerShell cause it generates 32 characters long string.


Came across this problem too, for me I was using windows powershell and it kept generating a 32 character key. When I switch to plain old cmd it worked as expected.


The generated hash is 32 characters because there is a carriage return and a newline added to the end. To fix this you can either:

Delete the last 5 characters of the hash, and add an "=" to the end. For example: "1234567890abcdefghijklmnopqrstuv" (32 chars) --> "1234567890abcdefghijklmnopq=" (28 chars)

Or:

pop open a javascript console, and use:

btoa(atob("your hash string").slice(0, -2))

Where "your hash string" is your 32 character hash.


TRY THE COMMAND IN COMMAND PROMPT !

it will ask you for password then you will get the hash key

Trying the same command on powershell doesn't provide correct hash key.