Beispiel #1
0
        public static void test(string base64in, int iterations)
        {
            byte[] bytes     = Convert.FromBase64String(base64in);
            byte[] zipped    = GZipHelper.NZip(bytes, iterations);
            string base64out = Convert.ToBase64String(zipped);

            Console.WriteLine(base64out);
            int previous_length;

            previous_length = base64in.Length;

            for (int i = 1; i <= iterations; i++)
            {
                int current_length = Convert.ToBase64String(GZipHelper.NUnzip(zipped, i)).Length;

                if (current_length < previous_length)
                {
                    Console.WriteLine($"Working for {i} iterations with {previous_length - current_length} difference");
                }
                previous_length = current_length;
            }
            if (base64in == Convert.ToBase64String(GZipHelper.NUnzip(zipped, iterations)))
            {
                Console.WriteLine("It works!");
                Console.ReadKey();
            }
        }
Beispiel #2
0
 public static byte[] FromBase64GZipped(string base64data, int iterations)
 {
     try
     {
         return(GZipHelper.NUnzip(Convert.FromBase64String(base64data), iterations));
     }
     catch
     {
         Console.WriteLine("[-] Error Unzipping");
         Environment.Exit(1);
     }
     return(null);
 }