Implementation of 1-2 oblivious transfer protocol for RSA requires a calculation of
]1
(source: rogercortesi.com)
and
(source: rogercortesi.com)
, then the results would be byte[]
arrays. How would one perform the addition and the modulo operation of the 2 arrays? Is using BitConverter.ToInt32()
useful at all in this case?
Asked
Active
Viewed 270 times
0

Glorfindel
- 21,988
- 13
- 81
- 109

Cobe
- 161
- 15
-
I think you probably don't want to go to `Int32`s. You need to figure out how to to addition on the byte arrays directly. I'm not sure if C# provides a nice way to do this. I guess you could just add them up byte-by-byte, then handling any overflow, and construct a new byte array in that fashion. – Noon Silk Oct 19 '14 at 00:55
-
yes adding byte by byte seems logical, but what about modulo operation? – Cobe Oct 19 '14 at 01:01
-
yeah. fair enough. have you tried looking at - http://en.wikipedia.org/wiki/Modular_exponentiation#Right-to-left_binary_method ? – Noon Silk Oct 19 '14 at 01:06
-
2Why don't you use the [BigInteger](http://msdn.microsoft.com/en-us/library/system.numerics.biginteger(v=vs.110).aspx) class? – President James K. Polk Oct 19 '14 at 01:45