abandon cp56time2a 2nd alg encode/decode, it has defect, but i will not fix
This commit is contained in:
parent
e5cbce5fd8
commit
da5ada644d
@ -40,7 +40,7 @@ public class CP56Time2a {
|
||||
result[2] = (byte) (date.get(Calendar.DAY_OF_MONTH));
|
||||
result[3] = (byte) (date.get(Calendar.MONTH) + 1);
|
||||
result[4] = (byte) (date.get(Calendar.YEAR) % 100);
|
||||
return reversehilo.concat(HexUtils.toHex(result)).toString();
|
||||
return reversehilo.concat(HexUtils.toHex(result)).substring(0, 14);
|
||||
}
|
||||
|
||||
public static String decode(byte b[]) {
|
||||
@ -87,21 +87,13 @@ public class CP56Time2a {
|
||||
|
||||
Date time = Calendar.getInstance().getTime();
|
||||
System.out.println(String.format("--未编码--: %s", time));
|
||||
String encode = encode(time);
|
||||
System.out.println("--解码--:" + decode(HexUtils.toBytes(encode)));
|
||||
String hex = toCp56Hex(time);
|
||||
System.out.println("--编码1--:" + hex);
|
||||
System.out.println("--解码1--:" + cp56toDate(hex));
|
||||
// String encode = encode(time);
|
||||
// System.out.println(String.format("--编码2--:%s", encode));
|
||||
// System.out.println("--解码2--:" + decode(HexUtils.toBytes(encode)));
|
||||
|
||||
// String hex = toCp56Hex(time);
|
||||
// System.out.println(String.format("--未编码--: %s", time));
|
||||
// System.out.println("--编码--:"+hex);
|
||||
// System.out.println("--解码--:"+cp56toDate(hex));
|
||||
// Thread.sleep(10000);
|
||||
// System.out.println("-----------");
|
||||
// System.out.println("-----------");
|
||||
// time = Calendar.getInstance().getTime();
|
||||
// hex = toCp56Hex(time);
|
||||
// System.out.println(String.format("--未编码--: %s", time));
|
||||
// System.out.println("--编码--:"+hex);
|
||||
// System.out.println("--解码--:"+cp56toDate(hex));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user