Скачиваний:
15
Добавлен:
01.05.2014
Размер:
877 б
Скачать
/*
* U.java
*
* Created on April 25, 2007, 11:28 PM
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/

package diffiehellmann;

/**
*
* @author adm
*/
public class U {

/** Creates a new instance of U */
public U() {
}


/**
*
* return a ^ x mod n
*
*/
public static void log(String s) {
System.out.println(s);
}
public static long modexp( long a, long x, long n) {
long r;
r = 1;
while ( x > 0 )
{
if ( (x % 2) == 1 )
{
r = (r * a) % n ;
}

a = ( a * a ) % n ;
x /= 2;
}
return r ;
}


}
Соседние файлы в папке diffiehellmann