aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/common/util/ByteUtil.java
diff options
context:
space:
mode:
authorJ08nY2018-02-04 18:03:54 +0100
committerJ08nY2018-02-04 18:03:54 +0100
commit18bfe2cdac09ff9faed5c92971a7e63d56570ac2 (patch)
treef356373dafd95a04c72de9e222280db2796b7ab1 /src/cz/crcs/ectester/common/util/ByteUtil.java
parentd940ed695fc36d2782d27c50e398fc185cf6fed3 (diff)
downloadECTester-18bfe2cdac09ff9faed5c92971a7e63d56570ac2.tar.gz
ECTester-18bfe2cdac09ff9faed5c92971a7e63d56570ac2.tar.zst
ECTester-18bfe2cdac09ff9faed5c92971a7e63d56570ac2.zip
Add more tests to the Wrong test suite.
- Now tests also for: - Fp: - p = 0 - p = 1 - p = q^2; q prime - p = q * s; q and s primes - F2m: - e1 = e2 = e3 = 0 - m < e1 < e2 < e3
Diffstat (limited to 'src/cz/crcs/ectester/common/util/ByteUtil.java')
-rw-r--r--src/cz/crcs/ectester/common/util/ByteUtil.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/cz/crcs/ectester/common/util/ByteUtil.java b/src/cz/crcs/ectester/common/util/ByteUtil.java
index 90c6eaa..ad9f1bf 100644
--- a/src/cz/crcs/ectester/common/util/ByteUtil.java
+++ b/src/cz/crcs/ectester/common/util/ByteUtil.java
@@ -39,6 +39,23 @@ public class ByteUtil {
return true;
}
+ public static byte[] shortToBytes(short value) {
+ byte[] result = new byte[2];
+ setShort(result, 0, value);
+ return result;
+ }
+
+ public static byte[] shortToBytes(short[] shorts) {
+ if (shorts == null) {
+ return null;
+ }
+ byte[] result = new byte[shorts.length * 2];
+ for (int i = 0; i < shorts.length; ++i) {
+ setShort(result, 2 * i, shorts[i]);
+ }
+ return result;
+ }
+
public static byte[] hexToBytes(String hex) {
return hexToBytes(hex, true);
}