core/src/main/java/org/bouncycastle/pqc/crypto/qtesla/QTESLA.java
/********************************************************************************************************************************************************************************************************
     * Description:	Encode Signature for Heuristic qTESLA Security Category-3 (Option for Speed) and Provably-Secure qTESLA Security Category-1
     ********************************************************************************************************************************************************************************************************/
Encode Signature for Heuristic qTESLA Security Category-3 (Option for Speed) and Provably-Secure qTESLA Security Category-1
Encode Signature for Heuristic qTESLA Security Category - 3 ( Option for Speed ) and Provably - Secure qTESLA Security Category - 1
private static void encodeSignatureIIISpeedIP(byte[] signature, int signatureOffset, byte[] C, int cOffset, long[] Z, int n, int d)
    {
        int j = 0;
        for (int i = 0; i < (n * d / Integer.SIZE); i += d / 2)
        {
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 0), (int)(((Z[j + 0] & ((1 << 22) - 1))) | (Z[j + 1] << 22)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 1), (int)((((Z[j + 1] >>> 10) & ((1 << 12) - 1))) | (Z[j + 2] << 12)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 2), (int)(((Z[j + 2] >>> 20) & ((1 << 2) - 1)) | ((Z[j + 3] & ((1 << 22) - 1)) << 2) | (Z[j + 4] << 24)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 3), (int)((((Z[j + 4] >>> 8) & ((1 << 14) - 1))) | (Z[j + 5] << 14)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 4), (int)(((Z[j + 5] >>> 18) & ((1 << 4) - 1)) | ((Z[j + 6] & ((1 << 22) - 1)) << 4) | (Z[j + 7] << 26)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 5), (int)((((Z[j + 7] >>> 6) & ((1 << 16) - 1))) | (Z[j + 8] << 16)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 6), (int)(((Z[j + 8] >>> 16) & ((1 << 6) - 1)) | ((Z[j + 9] & ((1 << 22) - 1)) << 6) | (Z[j + 10] << 28)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 7), (int)((((Z[j + 10] >>> 4) & ((1 << 18) - 1))) | (Z[j + 11] << 18)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 8), (int)(((Z[j + 11] >>> 14) & ((1 << 8) - 1)) | ((Z[j + 12] & ((1 << 22) - 1)) << 8) | (Z[j + 13] << 30)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 9), (int)((((Z[j + 13] >>> 2) & ((1 << 20) - 1))) | (Z[j + 14] << 20)));
            CommonFunction.store32(signature, signatureOffset + Integer.SIZE / Byte.SIZE * (i + 10), (int)((((Z[j + 14] >>> 12) & ((1 << 10) - 1))) | (Z[j + 15] << 10)));
            j += Integer.SIZE / 2;
        }
        System.arraycopy(C, cOffset, signature, signatureOffset + n * d / Byte.SIZE, Polynomial.HASH);
    }
private static void encodeSignatureIIISpeedIP ( byte [ ] signature , int signatureOffset , byte [ ] C , int cOffset , long [ ] Z , int n , int d ) { int j = 0 ; for ( int i = 0 ; i < ( n * d / Integer . SIZE ) ; i += d / 2 ) { CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 0 ) , ( int ) ( ( ( Z [ j + 0 ] & ( ( 1 << 22 ) - 1 ) ) ) | ( Z [ j + 1 ] << 22 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 1 ) , ( int ) ( ( ( ( Z [ j + 1 ] >>> 10 ) & ( ( 1 << 12 ) - 1 ) ) ) | ( Z [ j + 2 ] << 12 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 2 ) , ( int ) ( ( ( Z [ j + 2 ] >>> 20 ) & ( ( 1 << 2 ) - 1 ) ) | ( ( Z [ j + 3 ] & ( ( 1 << 22 ) - 1 ) ) << 2 ) | ( Z [ j + 4 ] << 24 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 3 ) , ( int ) ( ( ( ( Z [ j + 4 ] >>> 8 ) & ( ( 1 << 14 ) - 1 ) ) ) | ( Z [ j + 5 ] << 14 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 4 ) , ( int ) ( ( ( Z [ j + 5 ] >>> 18 ) & ( ( 1 << 4 ) - 1 ) ) | ( ( Z [ j + 6 ] & ( ( 1 << 22 ) - 1 ) ) << 4 ) | ( Z [ j + 7 ] << 26 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 5 ) , ( int ) ( ( ( ( Z [ j + 7 ] >>> 6 ) & ( ( 1 << 16 ) - 1 ) ) ) | ( Z [ j + 8 ] << 16 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 6 ) , ( int ) ( ( ( Z [ j + 8 ] >>> 16 ) & ( ( 1 << 6 ) - 1 ) ) | ( ( Z [ j + 9 ] & ( ( 1 << 22 ) - 1 ) ) << 6 ) | ( Z [ j + 10 ] << 28 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 7 ) , ( int ) ( ( ( ( Z [ j + 10 ] >>> 4 ) & ( ( 1 << 18 ) - 1 ) ) ) | ( Z [ j + 11 ] << 18 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 8 ) , ( int ) ( ( ( Z [ j + 11 ] >>> 14 ) & ( ( 1 << 8 ) - 1 ) ) | ( ( Z [ j + 12 ] & ( ( 1 << 22 ) - 1 ) ) << 8 ) | ( Z [ j + 13 ] << 30 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 9 ) , ( int ) ( ( ( ( Z [ j + 13 ] >>> 2 ) & ( ( 1 << 20 ) - 1 ) ) ) | ( Z [ j + 14 ] << 20 ) ) ) ; CommonFunction . store32 ( signature , signatureOffset + Integer . SIZE / Byte . SIZE * ( i + 10 ) , ( int ) ( ( ( ( Z [ j + 14 ] >>> 12 ) & ( ( 1 << 10 ) - 1 ) ) ) | ( Z [ j + 15 ] << 10 ) ) ) ; j += Integer . SIZE / 2 ; } System . arraycopy ( C , cOffset , signature , signatureOffset + n * d / Byte . SIZE , Polynomial . HASH ) ; }
Description:     Encode Signature for Heuristic qTESLA Security Category-3 (Option for Speed) and Provably-Secure qTESLA Security Category-1
Description : Encode Signature for Heuristic qTESLA Security Category - 3 ( Option for Speed ) and Provably - Secure qTESLA Security Category - 1