자바 문법을 비주얼베이직 문법으로 고치고싶습니다.. ㅠ
가림새
package l1j.server.server.encryptions;
import l1j.server.server.types.UChar8;
import l1j.server.server.types.ULong32;
public class {
private static int[] P = { 0x3F84D5B5 };
private static long[][] S = {
{ 0x0D1310BA6L } };
static {
for (int i = 0; i S.length; ++i) {
for (int j = 0; j S[i].length; ++j) {
S[i][j] = ULong32.fromLong64(S[i][j]);
}
}
}
private static int PSIZE = 18;// P.length;
private static int SSIZE = 256;
private static long v = 0, w = 0;
public static long[] blowfish_init(long[] keys) {
int i = 0;
int j = 0;
char[] c = UChar8.fromArray(keys);
for (i = 0; i PSIZE; i++) {
long k = 0L;
if ((i & 1) != 0) {
k = ((c[4] & 0xFF) 24) | ((c[5] & 0xff) 16)
| ((c[6] & 0xff) 8) | (c[7] & 0xff);
} else {
k = ((c[0] & 0xFF) 24) | ((c[1] & 0xff) 16)
| ((c[2] & 0xff) 8) | (c[3] & 0xff);
}
P[i] ^= k;
}
i = 0;
for (j = 0; j PSIZE / 2; j++, i += 2) {
blowfish_encrypt(v, w);
P[i] = (int) v;
P[i + 1] = (int) w;
}
v = ULong32.fromInt32((int) v);
w = ULong32.fromInt32((int) w);
keys = null;
i = 0;
int index = 0;
int index2 = i;
for (j = 0; j SSIZE * 2; j++, i += 2, index2 += 2) {
blowfish_encrypt(v, w);
if (i == 256) {
index = 1;
index2 = 0;
}
if (i == 512) {
index = 2;
index2 = 0;
}
if (i == 768) {
index = 3;
index2 = 0;
}
S[index][index2] = ULong32.fromInt32((int) v);
S[index][index2 + 1] = ULong32.fromInt32((int) w);
}
v = 0;
w = 0;
return keys;
}
public static long blowfish_F(long x) {
char[] c = UChar8.fromULong32(x);
int rtmp = (int) S[0][c[3]] + (int) S[1][c[2]];
long rtmp2 = rtmp ^ S[2][c[1]];
int rtmp3 = (int) rtmp2 + (int) S[3][c[0]];
return rtmp3;
}
public static void blowfish_encrypt(long L, long R) {
long temp, xL = L, xR = R;
for (int i = 0; i 16; i++) {
xL ^= P[i];
xL = ULong32.fromLong64(xL);
xR ^= blowfish_F(ULong32.fromLong64(xL));
xR = ULong32.fromLong64(xR);
temp = xL;
xL = xR;
xR = temp;
}
temp = xL;
xL = xR;
xR = temp;
R = xR ^ P[16];
L = xL ^ P[17];
R = ULong32.fromLong64(R);
L = ULong32.fromLong64(L);
v = L;
w = R;
}
void blowfish_decrypt(long L, long R) {
long temp, xL = L, xR = R;
for (int i = 17; i = 2; i--) {
xL ^= P[i];
xR ^= blowfish_F(xL);
temp = xL;
xL = xR;
xR = temp;
}
temp = xL;
xL = xR;
xR = temp;
R = xR ^ P[1];
L = xL ^ P[0];
}
public static long[] getSeeds(long[] keys) {
blowfish_init(keys);
long rotrParam = ULong32.fromLong64(keys[0] ^ 0x9C30D539);
keys[0] = ULong32.fromLong64(_rotr((int) rotrParam, 13));
keys[1] = (keys[1] ^ keys[0] ^ 0x7C72E993);
return keys;
}
public static int _rotr(int value, int n) {
return (value n) | (value (32 - n));
}
}
대강 이렇게 자바 문법이라는데,
비주얼베이직 문법으로 고쳐 보고 싶습니다.소스쪽들은 손댈필요없이 몇몇 문법구조만 봐꾸면 되는데..
도통 모르겠네요.자바쪽 문법이랑 비베쪽 문법등 동일하게 쓰이지만 쓰는법이 다른것들만 알려주셔도 한번 해보겠습니다..