题型:综合题 题类:常考题 难易度:普通
浙江省临海市白云高级中学2019届高三下学期信息技术3月月考试卷
先将字符转化为二进制的位数据并显示在文本框text2中,数据位数显示在标签Label1中以16个数据为一段,将k个待加密数据依次分割成若干个数据段,剩余数据(个数小于16)为独立数据段。
数据加密规则:
数据个数等于16的数据段,在段内进行位置变换,得到加密数据段。
数据个数小于16的数据段,直接得到加密数据段。
依次合并加密数据段,即为最后的加密数据。
位置变换的规制,方法如下:
具体界面如下图所示:
Private Sub Command1_Click()
Dim a(1 To 1000) As Integer, b(1 To 1000) As Integer
Dim n As Integer, m As Integer
Dim s As String, s1 As String, c As Integer, ch As String
s = Text1.Text: Text2.Text = ""
n = Len(s)
k = 1
For i = 1 To n ‘获取字符的二进制数据存放在数组a()中
n = Asc(Mid(s, i, 1))
Do While n <> 0
a(k) = n Mod 2
n = n \ 2
Text2.Text = Text2.Text + Str(a(k))
k = k + 1
Loop
Next i
①
List1.Clear
For m = 1 To (k - 1) \ 16 '对字符二进制按规则进行位变换,变换后的数据存放在数组b()中并输出
For i = 1 To 4
b(16 * (m - 1) + 4 * (i - 1) + 1) = a((m - 1) * 16 + i)
②
Next i
For i = 1 To 3
b(16 * (m - 1) + 4 * (i - 1) + 3) = a((m - 1) * 16 + 10 + i)
b(16 * (m - 1) + 4 * (i - 1) + 2) = a((m - 1) * 16 + 17 - i)
Next i
For i = 1 To 2
b(16 * (m - 1) + 13 + i) = a((m - 1) * 16 + 4 + i)
Next i
For i = 1 To 4
s1 = ""
For j = 1 To 4
s1 = s1 + Str(b(16 * (m - 1) + (i - 1) * 4 + j))
Next j
List1.AddItem s1
Next i
List1.AddItem ""
Next m
s1 = ""
For i = ((k - 1) \ 16) * 16 + 1 To k - 1
b(i) = a(i)
If ③ Then
s1 = s1 + Str(a(i))
List1.AddItem s1
s1 = ""
Else
s1 = s1 + Str(a(i))
End If
Next i
List1.AddItem s1
Text3.Text = ""
For i = 1 To k - 1
Text3.Text = Text3.Text + Str(b(i))
Next i
End Sub
实现上述功能,请在划线处填入适当的代码:
程序中①处填入的是。
程序中②处填入的是。
程序中③处填入的是。
试题篮