📄 passwordrecord.java
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi
// Source File Name: PasswordRecord.java
package jxl.write.biff;
import jxl.biff.*;
class PasswordRecord extends WritableRecordData
{
private String password;
private byte data[];
public PasswordRecord(String pw)
{
super(Type.PASSWORD);
password = pw;
if(pw == null)
{
data = new byte[2];
IntegerHelper.getTwoBytes(0, data, 0);
} else
{
byte passwordBytes[] = pw.getBytes();
int passwordHash = 0;
for(int a = 0; a < passwordBytes.length; a++)
{
int shifted = rotLeft15Bit(passwordBytes[a], a + 1);
passwordHash ^= shifted;
}
passwordHash ^= passwordBytes.length;
passwordHash ^= 0xce4b;
data = new byte[2];
IntegerHelper.getTwoBytes(passwordHash, data, 0);
}
}
public PasswordRecord(int ph)
{
super(Type.PASSWORD);
data = new byte[2];
IntegerHelper.getTwoBytes(ph, data, 0);
}
public byte[] getData()
{
return data;
}
private int rotLeft15Bit(int val, int rotate)
{
val &= 0x7fff;
for(; rotate > 0; rotate--)
if((val & 0x4000) != 0)
val = (val << 1 & 0x7fff) + 1;
else
val = val << 1 & 0x7fff;
return val;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -