04-27-2015 05:22 AM
Hello,
I've made DH algoritm (link) but I need it to calculate in hex, can someone please show me how to tweek my code for that?
04-27-2015 06:53 AM
HEX is a representation (in Base 16) of numeric (usually integer!!) data. Your code shows Dbl (64-bit floats), which is not an "exact" numeric representation, so is unlikely to implement Diffie-Hillman. I notice you use the remainder operator which is well-defined for integer representations, but whose meaning is unclear (to me) for floats.
You should only need to use Hex to turn an input representation into an internal numeric form for computations, and to transform the output into a final representation.
Rethink what you are doing.
Bob Schor