断点设置在函数内,发现返回值没有,需要取消函数内断点才正常

加密--采用矩阵乘法

行列式取+_1的矩阵与逆矩阵其元素都是整数,, 可以使用matlab来找到这些矩阵

PB的一些记录

A* I   =E       A^-1 * E=I   A与A^-1 加密矩阵与其逆矩阵, I是待加密矩阵,  E是加密后的矩阵

 

 

long ENMatrix[16]={  0,     1,     21,     1,2,     1,     3,     3,4,     0,     4,     1, 3,     0,     3,     1}
long DEMatrix[16]={-1,     1,     5,    -17,-1,     2,    12,   -18, 1,    -1,    -4,     6, 0,     0,    -3,     4}
int MixArr[16]={1,3,2,6,  15,7,4,84,  10,6,3,4, ,6,7,8,5 }
int i=1
int j =0 
int s2
string s1
string ret=""
string tmp=""
string arr[16]
j=len(vstr)
if j <>16 then
    messagebox('错误','只接受16位字符')
    return ""
end if
//只接受16位密码

long srcMatrix[16]
long tagMatrix[16]
for i = 1 to j
    s1= mid(vstr,i,1)
    srcMatrix[i] = asc(s1)
next
int row
int col
for row=1 to 4
    for col=1 to 4
        tagMatrix[(row -1) * 4 + col]=& 
            ENMatrix[(row -1)*4 +1] * srcMatrix[col -1 +1] &
        +  ENMatrix[(row -1)*4 +2] * srcMatrix[col -1 +5] & 
        +  ENMatrix[(row -1)*4 +3] * srcMatrix[col -1 +9]  & 
        +  ENMatrix[(row -1)*4 +4] * srcMatrix[col -1 +13]
    next
next

for i=1 to 16
       tmp=string(tagMatrix[i])
    arr[i]=right("000" +tmp ,4)
next


for i=1 to 16
    tmp=arr[1]
    arr[1]=arr[MixArr[i]]
    arr[MixArr[i]]=tmp
next
for i=1 to 16
    ret =ret+arr[i]
next

return ret
View Code

相关文章:

  • 2021-09-17
  • 2021-11-30
  • 2021-11-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-07
  • 2021-11-10
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-10-17
  • 2022-02-20
  • 2022-01-12
  • 2021-05-24
  • 2021-12-29
相关资源
相似解决方案