Methods Summary |
---|
public static java.lang.String | btoe(int index)
if (index < words.length) {
return words[index];
} else {
return "bogus";
}
|
void | calc()
if (this.sha == MD5) {
this.md5calc();
} else {
this.md4calc();
}
|
void | md4calc()
int tmpseq = this.seq;
md4 mdc;
mdc = new md4(this.seed + this.passphrase);
mdc.calc();
this.hash = otpfoldregs(mdc.getregs());
while (tmpseq > 0) {
mdc = new md4(hash);
mdc.calc();
this.hash = otpfoldregs(mdc.getregs());
tmpseq--;
}
|
void | md5calc()
int tmpseq = this.seq;
md5 mdc;
mdc = new md5(this.seed + this.passphrase);
mdc.calc();
this.hash = otpfoldregs(mdc.getregs());
while (tmpseq > 0) {
mdc = new md5(hash);
mdc.calc();
this.hash = otpfoldregs(mdc.getregs());
tmpseq--;
}
|
static byte[] | otpfoldregs(int[] regs)
int ac, bd, i;
byte fold[] = new byte[8];
ac = regs[0] ^ regs[2];
bd = regs[1] ^ regs[3];
for (i=0; i < 4; i++) {
fold[i] = (byte) (ac & 0xff);
ac >>= 8;
}
for (i=4; i < 8; i++) {
fold[i] = (byte) (bd & 0xff);
bd >>= 8;
}
return fold;
|
public java.lang.String | toString()
long wi, tmplong;
String tmpstr;
int i, j;
byte parity;
wi = this.tolong();
tmplong = wi;
tmpstr = "";
parity = 0;
for (i = 0; i < 64; i+=2) {
parity += tmplong & 0x3;
tmplong >>= 2;
}
for (i=4; i >= 0; i--) {
tmpstr += btoe((int)
((wi >> (i * 11 + 9)) & 0x7ff)) + " ";
}
tmpstr += btoe((int) ((wi << 2) & 0x7fc) | (parity & 0x03));
return tmpstr;
|
long | tolong()
long wi;
int i;
wi = 0;
for (i=0; i < 8; i++) {
wi <<= 8;
wi |= (this.hash[i] & 0xff);
}
return wi;
|