Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla-spongycastle.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Whittington <Tim.Whittington@orionhealth.com>2013-07-03 14:17:36 +0400
committerTim Whittington <Tim.Whittington@orionhealth.com>2013-07-03 14:17:36 +0400
commit3584506c7af63d2b47cd6dcc1d453b89d23b0a3f (patch)
tree43046ec0173faf9fe5ee5fc8aab23390dd7f8aaf /core/src/main/java/org/bouncycastle/util/Arrays.java
parent24eae4b6795663f586ad80107599c928418a7af5 (diff)
Initial implementation of Threefish + Skein in all supported block sizes, and Skein-MAC + HMAC-Skein in all supported block sizes and output sizes.
JCE registrations for all of these altos.
Diffstat (limited to 'core/src/main/java/org/bouncycastle/util/Arrays.java')
-rw-r--r--core/src/main/java/org/bouncycastle/util/Arrays.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/core/src/main/java/org/bouncycastle/util/Arrays.java b/core/src/main/java/org/bouncycastle/util/Arrays.java
index 457320eb..4c11cad6 100644
--- a/core/src/main/java/org/bouncycastle/util/Arrays.java
+++ b/core/src/main/java/org/bouncycastle/util/Arrays.java
@@ -423,6 +423,20 @@ public final class Arrays
return copy;
}
+ public static byte[] clone(byte[] data, byte[] existing)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+ if ((existing == null) || (existing.length != data.length))
+ {
+ return clone(data);
+ }
+ System.arraycopy(data, 0, existing, 0, existing.length);
+ return existing;
+ }
+
public static byte[][] clone(byte[][] data)
{
if (data == null)
@@ -470,6 +484,33 @@ public final class Arrays
return copy;
}
+ public static long[] clone(long[] data)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+ long[] copy = new long[data.length];
+
+ System.arraycopy(data, 0, copy, 0, data.length);
+
+ return copy;
+ }
+
+ public static long[] clone(long[] data, long[] existing)
+ {
+ if (data == null)
+ {
+ return null;
+ }
+ if ((existing == null) || (existing.length != data.length))
+ {
+ return clone(data);
+ }
+ System.arraycopy(data, 0, existing, 0, existing.length);
+ return existing;
+ }
+
public static short[] clone(short[] data)
{
if (data == null)