コード: 全て選択
#N88BASIC
'データを暗号化
Function EnC(in As *Byte, out As *Byte, l As Long) As Long
Dim Cind As Long
out[0] = in[0]
For Cind = 1 To l-1
out[Cind] = in[Cind]-in[Cind-1]
Next
End Function
'データを複合化
Function DeC(in As *Byte, out As *Byte, l As Long) As Long
Dim Cind As Long
out[0] = in[0]
For Cind = 1 To l-1
out[Cind] = in[Cind]+out[Cind-1]
Next
End Function
Function Show(in As *Byte, l As Long) As Long
Dim Cind As Long
Dim ele[45] As Byte
For Cind = 0 To l-1
wsprintf(ele, "%02x ", in[Cind])
Print MakeStr(ele);
Next
Print ""
End Function
'testo
Dim in[10] As Byte'元
Dim out[10] As Byte'暗号
Dim out2[10] As Byte'複合
wsprintf(in, "阿部高和")
Show(in, 10)
EnC(in, out, 10)
Show(out, 10)
DeC(out, out2, 10)
Show(out2, 10)