SHA256 Hash results different across Android & iOS for Big numbers
I'm trying to Hash a BigInteger/BigNum and I'm getting different results in Android/iOS. I need to get the same Hash result so that both the apps work as per the SRP protocol. On closer inspection it is working fine for positive numbers but not working for negative numbers (first nibble greater than 7). Not sure which one is correct and which one is to be adjusted to match with the other. Android: void hashBigInteger(String s) { try { BigInteger a = new BigInteger(s, 16); MessageDigest sha = MessageDigest.getInstance("SHA-256"); byte[] b = a.toByteArray(); sha.update(b, 0, b.length); byte[]