// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java
// public class ArrayUtils {
// 
//     public static int[] mergeArrays(byte[] mainArray, int[] appendArray){
// 
//         int[] array = new int[mainArray.length + appendArray.length];
// 
//         int mainSize = mainArray.length;
//         int appendSize = appendArray.length;
// 
//         for(int i = 0; i < mainSize; i++){
//             array[i] = mainArray[i];
//         }
// 
//         System.arraycopy(appendArray, 0, array, mainSize, appendSize);
// 
//         return array;
//     }
// 
//     public static int[] mergeArrays(int[] mainArray, int[] appendArray){
//         int[] array = new int[mainArray.length + appendArray.length];
// 
//         int mainSize = mainArray.length;
//         int appendSize = appendArray.length;
// 
//         System.arraycopy(mainArray, 0, array, 0, mainSize);
// 
//         System.arraycopy(appendArray, 0, array, mainSize, appendSize);
// 
//         return array;
//     }
// 
//     public static int[] convertListToArray(List<Integer> integerList){
//         int[] array = new int[integerList.size()];
// 
//         for(int i = 0; i < integerList.size(); i++){
//             array[i] = integerList.get(i);
//         }
// 
//         return array;
//     }
// }


import ru.bullyboo.encoder.utils.ArrayUtils;
     * becomes congruent to 0, modulo 16. At least one byte and at most 16
     * 16 bytes are appended.
     *
     * At this point the resulting message (after padding with bytes) has a
     * length that is an exact multiple of 16 bytes. Let M[0 ... N-1] denote
     * the bytes of the resulting message, where N is a multiple of 16.
     *
     * Copied from RFC 1319
     * Page 1
     * https://tools.ietf.org/html/rfc1319
     *
     */
    private int[] appendPaddingBytes(byte[] bytes){

        int size = bytes.length;

        int temp = size;

        do{
            temp++;
        } while (temp % 16 != 0);

        int value = temp - size;

        int[] paddingBytes = new int[value];

        for(int i = 0; i < value ; i++){
            paddingBytes[i] = value;
        }

// Path: encoder/src/main/java/ru/bullyboo/encoder/utils/ArrayUtils.java
// public class ArrayUtils {
// 
//     public static int[] mergeArrays(byte[] mainArray, int[] appendArray){
// 
//         int[] array = new int[mainArray.length + appendArray.length];
// 
//         int mainSize = mainArray.length;
//         int appendSize = appendArray.length;
// 
//         for(int i = 0; i < mainSize; i++){
//             array[i] = mainArray[i];
//         }
// 
//         System.arraycopy(appendArray, 0, array, mainSize, appendSize);
// 
//         return array;
//     }
// 
//     public static int[] mergeArrays(int[] mainArray, int[] appendArray){
//         int[] array = new int[mainArray.length + appendArray.length];
// 
//         int mainSize = mainArray.length;
//         int appendSize = appendArray.length;
// 
//         System.arraycopy(mainArray, 0, array, 0, mainSize);
// 
//         System.arraycopy(appendArray, 0, array, mainSize, appendSize);
// 
//         return array;
//     }
// 
//     public static int[] convertListToArray(List<Integer> integerList){
//         int[] array = new int[integerList.size()];
// 
//         for(int i = 0; i < integerList.size(); i++){
//             array[i] = integerList.get(i);
//         }
// 
//         return array;
//     }
// }


// Path: encoder/src/main/java/ru/bullyboo/encoder/hashes/MD2.java
import ru.bullyboo.encoder.utils.ArrayUtils;

     * becomes congruent to 0, modulo 16. At least one byte and at most 16
     * 16 bytes are appended.
     *
     * At this point the resulting message (after padding with bytes) has a
     * length that is an exact multiple of 16 bytes. Let M[0 ... N-1] denote
     * the bytes of the resulting message, where N is a multiple of 16.
     *
     * Copied from RFC 1319
     * Page 1
     * https://tools.ietf.org/html/rfc1319
     *
     */
    private int[] appendPaddingBytes(byte[] bytes){

        int size = bytes.length;

        int temp = size;

        do{
            temp++;
        } while (temp % 16 != 0);

        int value = temp - size;

        int[] paddingBytes = new int[value];

        for(int i = 0; i < value ; i++){
            paddingBytes[i] = value;
        }

        return ArrayUtils.mergeArrays(bytes, paddingBytes);