On client side I am doing an MD5 encryption of a string and then a BASE 64 encoding on the hash generated.
This final encoded string is then used for comparison on serve
You have the MD5 Hash 291423A531148527A9524EA0924CDF68 that generates the Base64 encoded string MjkxNDIzQTUzMTE0ODUyN0E5NTI0RUEwOTI0Q0RGNjg= , which is fine. You have converted the MD5 hash to an ascii hex representation, and base64 encoded that.
However your own getHashCode() works differently, it creates a base64 encoding of the binary representation of your hash code, you have not converted your hash to an ascii hex representation, and that's why you see different base64 encoded strings.
The accepted answer solves the problem but does not answer the question.
For example, these base64 values QzNWwq==
and QzNWwr==
encode the same binary value (hex) 433356c2
You can check it at http://kjur.github.io/jsjws/tool_b64udec.html or using the command
echo <<BASE64>> | base64 -d | xxd
In summary