All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.pqc.crypto.gmss.GMSSUtils Maven / Gradle / Ivy

Go to download

The Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms. This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5 to JDK 1.8.

There is a newer version: 1.79
Show newest version
package org.bouncycastle.pqc.crypto.gmss;

import java.util.Enumeration;
import java.util.Vector;

import org.bouncycastle.util.Arrays;

class GMSSUtils
{
    static GMSSLeaf[] clone(GMSSLeaf[] data)
    {
        if (data == null)
        {
            return null;
        }
        GMSSLeaf[] copy = new GMSSLeaf[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);

        return copy;
    }

    static GMSSRootCalc[] clone(GMSSRootCalc[] data)
    {
        if (data == null)
        {
            return null;
        }
        GMSSRootCalc[] copy = new GMSSRootCalc[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);

        return copy;
    }

    static GMSSRootSig[] clone(GMSSRootSig[] data)
    {
        if (data == null)
        {
            return null;
        }
        GMSSRootSig[] copy = new GMSSRootSig[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);

        return copy;
    }

    static byte[][] clone(byte[][] data)
    {
        if (data == null)
        {
            return null;
        }
        byte[][] copy = new byte[data.length][];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = Arrays.clone(data[i]);
        }

        return copy;
    }

    static byte[][][] clone(byte[][][] data)
    {
        if (data == null)
        {
            return null;
        }
        byte[][][] copy = new byte[data.length][][];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = clone(data[i]);
        }

        return copy;
    }

    static Treehash[] clone(Treehash[] data)
    {
        if (data == null)
        {
            return null;
        }
        Treehash[] copy = new Treehash[data.length];

        System.arraycopy(data, 0, copy, 0, data.length);

        return copy;
    }

    static Treehash[][] clone(Treehash[][] data)
    {
        if (data == null)
        {
            return null;
        }
        Treehash[][] copy = new Treehash[data.length][];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = clone(data[i]);
        }

        return copy;
    }

    static Vector[] clone(Vector[] data)
    {
        if (data == null)
        {
            return null;
        }
        Vector[] copy = new Vector[data.length];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = new Vector();
            for (Enumeration en = data[i].elements(); en.hasMoreElements();)
            {
                copy[i].addElement(en.nextElement());
            }
        }

        return copy;
    }

    static Vector[][] clone(Vector[][] data)
    {
        if (data == null)
        {
            return null;
        }
        Vector[][] copy = new Vector[data.length][];

        for (int i = 0; i != data.length; i++)
        {
            copy[i] = clone(data[i]);
        }

        return copy;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy