We are trying to duplicate the sha1 crypto encoding done in our java 1.6 server with the iOS/iPhone CommonCrypto libraries.
A basic question I have is why does Java have a fix output of 40 bytes while iOS has a fix output of 20 bytes from the SHA1 algorithms
I have found this link which shows how to generate the encoding in both environments but the output would be of different lengths, correct?
The SHA1 algorithm always return 160 bits (or 20 bytes).
I suspect your Java code is turning the byte array into a hexadecimal string, i.e. where each byte would show as two characters.
To compare this with CommonCrypto you can either:
convert the Java output to a byte array; or
convert the CommonCrypto byte array to an hexadecimal string (this is what the link in your question is doing)
before comparing the values.