0

Implementation of 1-2 oblivious transfer protocol for RSA requires a calculation of v](https://upload.wikimedia.org/math/5/b/2/5b2f29ecb81e9dcd95061b333f2e6f2c.png). If we'd have previously used the class <code>RSACryptoServiceProvider</code>, for  calculating [![x]1
(source: rogercortesi.com)
and k
(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?

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
  • 2
    Why 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

0 Answers0