Java代码如下
String strResult = "";
String s;
int nch; char[] chrArrs = strMsg.toCharArray(); for (int i=0; i<chrArrs.length; i++) {
// XOR ascii value of character with random number
nch = chrArrs[i] ^ randstr[i % 64];
s = Integer.toHexString(nch);
if (s.length() < 2) s = "0" + s;
strResult += s;
}其中randstr是一个全局的64个元素的数组
String strResult = "";
String s;
int nch; char[] chrArrs = strMsg.toCharArray(); for (int i=0; i<chrArrs.length; i++) {
// XOR ascii value of character with random number
nch = chrArrs[i] ^ randstr[i % 64];
s = Integer.toHexString(nch);
if (s.length() < 2) s = "0" + s;
strResult += s;
}其中randstr是一个全局的64个元素的数组
strResult = ""
Dim nch As Long
Dim byteArrs() As Byte'VB中没有字符数组,chrArrs改成字节数组
'VB中没有字符数组,原chrArrs改成字节数组byteArrs
byteArrs = strMsg.toCharArray Dim i As Long
For i = 0 To UBound(byteArrs)
nch = byteArrs(i) Xor randstr(i Mod 64)
s = Hex(nch)
If Len(s) < 2 Then s = "0" & s
strResult = strResult & s
Next
byteArrs = strMsg.toCharArray
应该是
byteArrs = StrConv(strMsg,vbFromUnicode)
但是StrConv这个function我好像没有,所以编译不过,请帮帮忙!cobrastudio(老汉我),呵呵,我也是试着改写过的,但是不成功,主要是因为对VB的这些函数不大了解,所以才求助的。