Support for push preauth

This commit is contained in:
Moxie Marlinspike
2019-06-06 17:31:07 -07:00
parent 18037bb484
commit 4fdbe9b9ff
22 changed files with 391 additions and 103 deletions

View File

@@ -31,14 +31,18 @@ public class Hex {
};
public static String toString(byte[] bytes) {
return toString(bytes, 0, bytes.length);
return toString(bytes, 0, bytes.length, false);
}
public static String toString(byte[] bytes, int offset, int length) {
public static String toStringCondensed(byte[] bytes) {
return toString(bytes, 0, bytes.length, true);
}
public static String toString(byte[] bytes, int offset, int length, boolean condensed) {
StringBuffer buf = new StringBuffer();
for (int i = 0; i < length; i++) {
appendHexChar(buf, bytes[offset + i]);
buf.append(' ');
if (!condensed) buf.append(' ');
}
return buf.toString();
}

View File

@@ -170,6 +170,10 @@ public class Util {
return Arrays.hashCode(objects);
}
public static boolean isEquals(Object first, Object second) {
return (first == null && second == null) || (first == second) || (first != null && first.equals(second));
}
public static long todayInMillis() {
return TimeUnit.DAYS.toMillis(TimeUnit.MILLISECONDS.toDays(System.currentTimeMillis()));
}