Improved various code bits
This commit is contained in:
@@ -46,13 +46,13 @@ public class BinTools {
|
||||
if (b == null) {
|
||||
return "";
|
||||
}
|
||||
StringBuffer sb = new StringBuffer(2 * b.length);
|
||||
for (int i = 0; i < b.length; i++) {
|
||||
int v = (256 + b[i]) % 256;
|
||||
sb.append(hex.charAt((v / 16) & 15));
|
||||
sb.append(hex.charAt((v % 16) & 15));
|
||||
StringBuffer stringBuffer = new StringBuffer(2 * b.length);
|
||||
for (byte aB : b) {
|
||||
int v = (256 + aB) % 256;
|
||||
stringBuffer.append(hex.charAt((v / 16) & 15));
|
||||
stringBuffer.append(hex.charAt((v % 16) & 15));
|
||||
}
|
||||
return sb.toString();
|
||||
return stringBuffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -363,7 +363,7 @@ public class PBKDF2Engine implements PBKDF2 {
|
||||
* 3.</a>
|
||||
*/
|
||||
protected void INT(byte[] dest, int offset, int i) {
|
||||
dest[offset + 0] = (byte) (i / (256 * 256 * 256));
|
||||
dest[offset] = (byte) (i / (256 * 256 * 256));
|
||||
dest[offset + 1] = (byte) (i / (256 * 256));
|
||||
dest[offset + 2] = (byte) (i / (256));
|
||||
dest[offset + 3] = (byte) (i);
|
||||
|
||||
Reference in New Issue
Block a user