怎样把以下代码从DELPHI转成java了?
DELPHI CODE:
BitIP: array[0..63] of Byte = //初始值置IP
(57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7,
56, 48, 40, 32, 24, 16, 8, 0,
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6 );procedure initPermutation(var inData: array of Byte);
var
newData: array[0..7] of Byte;
i: Integer;
begin
FillChar(newData, 8, 0);
for i := 0 to 63 do
if (inData[BitIP[i] shr 3] and (1 shl (7- (BitIP[i] and $07)))) <> 0 then
newData[i shr 3] := newData[i shr 3] or (1 shl (7-(i and $07)));
for i := 0 to 7 do inData[i] := newData[i];
end;function si(s,inByte: Byte): Byte;
var
c: Byte;
begin
c := (inByte and $20) or ((inByte and $1e) shr 1) or
((inByte and $01) shl 4);
Result := (sBox[s][c] and $0f);
end;
DELPHI CODE:
BitIP: array[0..63] of Byte = //初始值置IP
(57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7,
56, 48, 40, 32, 24, 16, 8, 0,
58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6 );procedure initPermutation(var inData: array of Byte);
var
newData: array[0..7] of Byte;
i: Integer;
begin
FillChar(newData, 8, 0);
for i := 0 to 63 do
if (inData[BitIP[i] shr 3] and (1 shl (7- (BitIP[i] and $07)))) <> 0 then
newData[i shr 3] := newData[i shr 3] or (1 shl (7-(i and $07)));
for i := 0 to 7 do inData[i] := newData[i];
end;function si(s,inByte: Byte): Byte;
var
c: Byte;
begin
c := (inByte and $20) or ((inByte and $1e) shr 1) or
((inByte and $01) shl 4);
Result := (sBox[s][c] and $0f);
end;
解决方案 »
- ssh中,js如何获取多选框的值并传入action,下面是我的代码,大家帮忙修改一下,并帮我写出action感激不尽
- java socket
- 请问高手为什么用JAVA的HTTP递交给JAVAServelet的时候,中文变成乱码了,急教!!!!!!!
- 如何让JLabel分多行显示?
- 由于程序要反复读取某个表中的数据,我想把表中的数据读取出来放到内存中,java好像提供了类似的类,请高手指点
- 有人知道QQ游戏的俄罗斯方块的原理吗?整个流程的原理,谁有俄罗斯方块的代码?最好JAVA的!
- java中<<和>>运算符,请给几个在实际中应用例子。
- 有做过视频点播系统的吗,能给我点思路吗?
- 如何让一个类只生成一个实例 ?
- 请问怎么在java程序中用VB代码,是不是可以用COM组件
- 关于 HelloWord的小程序,有若干处不解高手请进
- JTable 页面跳转
查jdk文档