Load()?‘以随机数模拟读取原始数据Р s = ""Р RandomizeР For i = 1 To nР‘①Р a(i) = Int(Rnd * 16)Р Text1.Text = Text1.Text + Mid(code, a(i), 1) Р Next iРEnd SubРPrivate mand1_Click()РFor i = 1 To nР t = t + HtoB(a(i))РNext iРFor j = 1 To n * 4 Step 8?'每8位一组,取前6个字符Р s = s + Mid(t, j, 6)РNext jРFor i = 1 To 4 * (n - 1) Step 4?'每4位一组转为十六进制显示Р Text2.Text = Text2.Text + BtoH(Mid(s, i, 4))РNext iРEnd SubРFunction HtoB(x As Integer) As String?'十六进制转为二进制函数Р t = ""Р m = 0Р‘②Р Do While x = 0 Р r = x Mod 2Р m = m + 1Р t = Trim(r) + t?'trim()用于删除前导空格Р x = x \ 2Р LoopР HtoB = Mid("0000", 1, 4 - m) + tРEnd FunctionРFunction BtoH(y As String) As String?'二进制转为十六进制函数Р t1 = Val(Mid(y, 4, 1))Р t2 = Val(Mid(y, 3, 1))Р t3 = Val(Mid(y, 2, 1))Р t4 = Val(Mid(y, 1, 1))Р s = t1 + t2 * 2 + t3 * 4 + t4 * 8Р BtoH = Mid(code, s + 1, 1)