PB的一些记录

时间:2023-03-08 15:42:13

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

加密--采用矩阵乘法

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

PB的一些记录

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

long ENMatrix[]={  ,     ,     ,     ,,     ,     ,     ,,     ,     ,     , ,     ,     ,     }
long DEMatrix[]={-, , , -,-, , , -, , -, -, , , , -, }
int MixArr[]={,,,, ,,,,, ,,,, ,,,, }
int i=
int j =
int s2
string s1
string ret=""
string tmp=""
string arr[]
j=len(vstr)
if j <> then
messagebox('错误','只接受16位字符')
return ""
end if
//只接受16位密码 long srcMatrix[]
long tagMatrix[]
for i = to j
s1= mid(vstr,i,)
srcMatrix[i] = asc(s1)
next
int row
int col
for row= to
for col= to
tagMatrix[(row -) * + col]=&
ENMatrix[(row -)* +] * srcMatrix[col - +] &
+ ENMatrix[(row -)* +] * srcMatrix[col - +] &
+ ENMatrix[(row -)* +] * srcMatrix[col - +] &
+ ENMatrix[(row -)* +] * srcMatrix[col - +]
next
next for i= to
tmp=string(tagMatrix[i])
arr[i]=right("" +tmp ,)
next for i= to
tmp=arr[]
arr[]=arr[MixArr[i]]
arr[MixArr[i]]=tmp
next
for i= to
ret =ret+arr[i]
next return ret

解密

long ENMatrix[]={  ,     ,     ,     ,,     ,     ,     ,,     ,     ,     , ,     ,     ,     }
long DEMatrix[]={-, , , -,-, , , -, , -, -, , , , -, }
int MixArr[]={,,, ,,,, ,,,, ,,, }
int i=
int j =
int s2
string s1
int arr[]
string tmp
int tmpInt
string ret
j=len(vstr) if j <>* then
messagebox('错误','只接受16位字符')
return ""
end if
//只接受16位密码
for i= to
arr[i]= integer(mid(vstr,(i -)* +,))
next
for i= to
tmpInt=arr[MixArr[ -i+]]
arr[MixArr[ -i+]]=arr[]
arr[]=tmpInt
next long tagMatrix[]
int row
int col
for row= to
for col= to
tagMatrix[(row -) * + col]=&
DEMatrix[(row -)* +] * arr[col - +] &
+ DEMatrix[(row -)* +] * arr[col - +] &
+ DEMatrix[(row -)* +] * arr[col - +] &
+ DEMatrix[(row -)* +] * arr[col - +]
next
next for i= to
ret=ret + char(tagMatrix[i])
next
return ret