Guest

Untitled

By: a guest on Jan 28th, 2012  |  syntax: None  |  size: 0.41 KB  |  hits: 42  |  expires: Never
download  |  raw  |  embed  |  report abuse
Copied
  1. public BigInteger encrypt(BigInteger message)
  2.   {
  3.     return message.modPow(e, n);
  4.   }
  5.   public BigInteger decrypt(BigInteger message)
  6.   {
  7.     return message.modPow(d, n);
  8.   }
  9.  
  10. //notice how sign uses (d, n) instead of (e, n)
  11.   public BigInteger sign(BigInteger message){
  12.           return message.modPow(d, n);
  13.   }
  14. //same here
  15.   public BigInteger verify(BigInteger message){
  16.           return message.modPow(e, n);
  17.   }