Non-numeric Diffie-Hellman? It may seem that this is a programming question, but I just need advice on the cryptography side of the question. I want to implement the Diffie-Hellman key exchange algorithm on iOS (since no free library with easy integration exists). I'm wondering how the implementation would be if the parameters would be – for example – 128 bytes of data, instead of integers.

I'm looking for instructions so that I find out how I should implement it because performing such operations on non-integers is quite ambiguous to me.

Sorry if it's a newbie question, but I'm new to this concept.

Any suggestions is really appreciated.
Diffie-Hellman relies on a mathematical problem on positive integers. To use it with bytes you just have to convert the bytes to - or use the bytes as - an integer. Usually this would be a unsigned big-endian (or network order) integer.

For Diffie-Hellman the parameters consist of the modulus and the base. The public value could be 1024 bits (128 bytes). 1024 bit cryptography is considered "legacy strength" for discrete logarithm related problems though.



With Java for instance the conversion can be as easy as new BigInteger(1, data) where 1 indicates a positive integer and data is a byte array.