Euler函数: m = p1^r1 * p2^r2 * …… * pn^rn ai >= 1 , 1 <= i <= n Euler函数: 定义:phi(m) 表示小于等于m并且与m互质的正整数的个数。 phi(m) = p1^(r1-1)*(p1-1) * p2^(r2-1)*(p2-1) * …… * pn^(rn-1)*(pn-1) = m*(1 - 1/p1)*(1 - 1/p2)*……*(1 - 1/pn) = p1^(r1-1)*p2^(r2-1)* …… * pn^(rn-1)*phi(p1*p2*……*pn) 定理:若(a , m) = 1 则有 a^phi(m) = 1 (MOD m) 即a^phi(m) - 1 整出m 在实际代码中可以用类似素数筛法求出 for (i = 1 i < MAXN i++) phi[i] = i for (i = 2 i < MAXN i++) if (phi[i] == i) { for (j = i j < MAXN j += i) { phi[j] /= i phi[j] *= i - 1 } } 容斥原理:定义phi(p) 为比p小的与p互素的数的个数 设n的素因子有p1, p2, p3, … pk 包含p1, p2…的个数为n/p1, n/p2… 包含p1*p2, p2*p3…的个数为n/(p1*p2)… phi(n) = n - sigm_[i = 1](n/pi) + sigm_[i!=j](n/(pi*pj)) - …… +- n/(p1*p2……pk) = n*(1 - 1/p1)*(1 - 1/p2)*……*(1 - 1/pk)
上传时间: 2014-01-10
上传用户:wkchong
1) 找出两个相异的大素数P和Q,令N=P×Q,M=(P-1)(Q-1)。 2) 找出与M互素的大数E,用欧氏算法计算出大数D,使D×E≡1 MOD M。 3) 丢弃P和Q,公开E,D和N。E和N即加密密钥,D和N即解密密钥。
标签: 大素数
上传时间: 2017-02-05
上传用户:lhw888
加密的步骤 1) 计算N的有效位数tn(以字节数计),将最高位的零忽略掉,令tn1=tn-1。比如N=0x012A05,其有效位数tn=5,tn1=4。 2) 将明文数据A分割成tn1位(以字节数计)的块,每块看成一个大数,块数记为bn。从而,保证了每块都小于N。 3) 对A的每一块Ai进行Bi=Ai^E MOD N运算。Bi就是密文数据的一块,将所有密文块合并起来,就得到了密文数据B。
上传时间: 2014-12-05
上传用户:caozhizhi
PL-SQL编程源码,该源码实现了自定义MOD函数判断质数问题,经测试,结果正确。可以判断从你输入的两个数之间的全部质数并输出。
上传时间: 2017-02-21
上传用户:ghostparker
IML package provides efficient routines to solve nonsingular systems of linear equations, certified solve any shape systems of linear equations, and perform MOD p matrix operations, such as computing row-echelon form, determinant, rank profile, inverse of a MOD p matrix.
标签: nonsingular efficient equations certifie
上传时间: 2017-03-21
上传用户:leixinzhuo
with this rar file i am sending five source codes in vhdl for xor gate,xor gate using tristae gate,electronic voting machine,MOD 16 counter,jk flip flop.please accept these codes and make me member of this site.so that i can download code from this site also.i really needed codes please accept that as soon as possible.
上传时间: 2013-12-18
上传用户:wcl168881111111
USACO 1.1.1 美国信息学奥林匹克竞赛第一题题解。 http://ace.delos.com/usacoprob2?a=tm4lT30HPme&S=ride 问题描述 科学家们在研究彗星后惊讶地发现,在每一个彗星后面都有一个不明飞行物UFO。 这些不明飞行物时常来带走来自地球上的一些支持者。不幸地,他们的空间在每次旅行只能带上一群支持者。 他们要做的是用一种聪明的方案让某个支持彗星UFO的团体都被彗星带走。他们为每个彗星起了一个名字,通过这些名字来决定一个团体是不是特定的彗星带走。 那个相配方案的细节是这样的: 所有团体的名字和彗星的名字都以下列各项方式转换成一个数字: 这个最后的数字代表名字中所有字母的信息,"A" 是 1 和 "Z" 是 26。 举例来说,团体 "USACO" 会是 21*19*1*3*15=17955 。 如果团体的数字 MOD 47 等于慧星的数字 MOD 47,那么你要告诉这个团体:准备好行李,走吧 ! 现在,你要写一个程序来通过团体的名字和彗星的名字来决定一个组是否应该与在那一颗彗星后面的不明飞行物搭配。 写一个程序读入彗星的名字和团体的名字,如果搭配打印"GO"否者打印"STAY" 团体的名字和彗星的名字将会是没有空格或标点的一串大写字母(不超过6个字母)。
标签: usacoprob USACO delos HPme
上传时间: 2017-05-20
上传用户:希酱大魔王
欧拉定理 对于互质的整数a和n,有aφ(n) ≡ 1 MOD n
上传时间: 2014-01-02
上传用户:330402686
RSA ( Rivest Shamir Adleman )is crypthograph system that used to give a secret information and digital signature . Its security based on Integer Factorization Problem (IFP). RSA uses an asymetric key. RSA was created by Rivest, Shamir, and Adleman in 1977. Every user have a pair of key, public key and private key. Public key (e) . You may choose any number for e with these requirements, 1< e <Æ (n), where Æ (n)= (p-1) (q-1) ( p and q are first-rate), gcd (e,Æ (n))=1 (gcd= greatest common divisor). Private key (d). d=(1/e) MOD(Æ (n)) Encyption (C) . C=Mª MOD(n), a = e (public key), n=pq Descryption (D) . D=C° MOD(n), o = d (private key
标签: crypthograph information Adleman Rivest
上传时间: 2017-09-01
上传用户:chfanjiang
RANSAC (RANdom SAmple Consensus) is an iterative method to estimate parameters of a mathematical MODel from a set of observed data which contains outliers. Source code is in Document
标签: mathematical parameters Consensus iterative
上传时间: 2017-09-09
上传用户:a6697238