public static byte[][][] generateForNDes(String key, int nDes) {
        // hash the master key to create longer keys and to minimalize the chance
        // of weak keys and as a consequence a weak encryption
        byte[] hash = createHash(key);
      
        // nDes cannot be too big
        // every generation of subkeys needs a key of 8 bytes
        nDes =  Math.max(nDes, (hash.length / 8)); 

        //  generate nDes times 16 subkeys
        byte[][][] subKeysNDes = new byte[nDes][][];
        for (int i = 0; i < nDes; i++) {
            subKeysNDes[i] = generateSubKeys(Arrays.copyOfRange(hash, i, i + 8));
        }

        return subKeysNDes;
    }