c_has_rfd => 0,
c_yclk_is_rising => 1,
c_has_we => 0,
c_sinit_value => "0",
c_has_limit_data_pitch => 0,
c_enable_rlocs => 0,
c_has_din => 0,
c_write_mode => 0);
BEGIN
U0 : wrapped_prime_rom
port map (
addr => addr,
clk => clk,
dout => dout,
en => en);
END prime_rom_a;
-- synopsys translate_on
ПРИЛОЖЕНИЕ Б
Исходный код файла
► myRSA.java
/*
Author: Bobby Kenny
Email: borrisoleigh@hotmail.com
Implementation of the RSA Algorithm:
Program Computes Public and Private keys.
The user then inputs an integer to be encrypted
using the private key. Ths encrypted integer is
then decrypted and is compared with the original
integer.
Modification note for using this program: Qian Wan
Email: qw2@cec.wustl.edu
Since the author's original Console class cannot be found, so hardcoded inputs are used here at:
int bitlen = 2048 ;
and
BigInteger big = new BigInteger("76901036849173733f27cc96762e1757c5de96983f5f4cee8032554ebc3e........
*/
import java.lang.*;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.io.*;
class BigExtendedEuclid
{
// We Want to obtain the gcd(a,b)
// a b 0 1 1 0
public BigInteger[] EE(BigInteger a, BigInteger b, BigInteger c, BigInteger d, BigInteger e, BigInteger f)
{
if (b.compareTo(BigInteger.ZERO)==0)
{
BigInteger[] ret = {BigInteger.ZERO, BigInteger.ZERO, BigInteger.ZERO};
ret[0] = a; // gcd(a,b)
ret[1] = e; // coefficient of a
ret[2] = f; // coefficient of b
return ret;
}
else
{
Return EE(b, a.mod(b), e.subtract((a.divide(b)).multiply(c)), f.subtract((a.divide(b)).multiply(d)), c, d);
}
}
}
class MillerRabin
{
public int primeT(BigInteger pval)
{
BigInteger [] qandm = getqm(pval);
BigInteger qval =qandm[0];
BigInteger neg = new BigInteger("-1");
if (qval.compareTo(neg)==0)return 0;
SecureRandom r = new SecureRandom();
BigInteger bval = new BigInteger(pval.bitLength(),r);
BigInteger mval =qandm[1];
BigInteger two = new BigInteger("2");
BigInteger pminusone = pval.subtract(BigInteger.ONE);
if (bval.modPow(mval,pval).compareTo(BigInteger.ONE)==0)return 1;
BigInteger j = BigInteger.ZERO;
BigInteger indexval = mval;
while (j.compareTo(qval)<0)
{
if (pminusone.compareTo(bval.modPow(indexval,pval))==0)return 1;
indexval = indexval.multiply(two);
j = j.add(BigInteger.ONE);
}
return 0;
}
public BigInteger createPrime(int bitlength, int numTests)
{
SecureRandom r = new SecureRandom();
BigInteger p = new BigInteger(bitlength,r);
int h = 0;
while(h < numTests)
{
if(primeT(p)==0)break;
else h++;
}
if(h==numTests)return p;
else return createPrime(bitlength, numTests);
}
public BigInteger [] getqm(BigInteger p)
Уважаемый посетитель!
Чтобы распечатать файл, скачайте его (в формате Word).
Ссылка на скачивание - внизу страницы.