simplepoker.m

来自「vigenere密码解密的matlab实现」· M 代码 · 共 38 行

M
38
字号
% This program plays a simplified poker gameclearcards=['ten';'ace';'que';'jac';'kin'];% Convert the cards to numerical values:cvals=text2int1(cards)%% p=300649;% generate a random exponent k with gcd(k,p-1)=1k=khide(p);% Shuffle and hide the cardsshufvals=shuffle(cvals,k,p)% Now reveal the cardsreveal(shufvals,k,p)% Now the advise functionadvise(shufvals,p)% To see that the ace was the only quadratic non-residue modulo p% we do the following test:powermod(cvals,(p-1)/2,p)

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?