?? pub_key_gen.m
字號(hào):
%% The public key generator for the receiver%% Here the receiver chooses p, Alpha, and is assigned the% secret key (the secret key is already set in this algorithm.% The public key Betaa is computed.% Allow these variables to be global throughout the sessionglobal y1 y2 num_plaintext % Load numtheory for Maple which has useful funcionsmaple('with(numtheory)');disp('Warning: it may take a few minutes to generate Alpha in some cases.')% **********Set the secret key for the user*********** %% This is where you need to change the code to change the secret keymaple('a:=', 245674);disp(' ')disp('Publishing p, Alpha and Betaa:')% Generate a random prime p (p is between 0 and 2^128)maple('p:=','nextprime(rand(0..2^128)())')p = maple('p');% Compute the primitive root Alphamaple('Alpha:=','primroot(p)')Alpha = maple('Alpha');% Compute the public key Betamaple('Betaa:=','(Alpha^a) mod p')Betaa = maple('Betaa');
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -