From 7f56ca985a706a8a68443640348a54e14ec82621 Mon Sep 17 00:00:00 2001
From: Jack Tjaden <jack@wolfssl.com>
Date: Tue, 28 Jan 2025 13:39:46 -0700
Subject: [PATCH] removal of table for symertric ciphers and addition of mode
 for RSA results

---
 examples/provider/CryptoBenchmark.java | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

diff --git a/examples/provider/CryptoBenchmark.java b/examples/provider/CryptoBenchmark.java
index bae3646..55a7bab 100644
--- a/examples/provider/CryptoBenchmark.java
+++ b/examples/provider/CryptoBenchmark.java
@@ -127,7 +127,7 @@ private static void printDeltaTable() {
                         deltaPercent = ((wolfSpeed / otherSpeed) - 1.0) * 100;
                     }
                     System.out.printf("| %-40s | %-8s | %+8.2f | %+8.1f |%n",
-                    operation,
+                    operation.replace("RSA", "RSA/ECB/PKCS1Padding RSA"),
                     provider,
                     deltaValue,
                     deltaPercent);
@@ -223,7 +223,7 @@ private static void runEncDecBenchmark(String algorithm, String mode, String pad
         encryptThroughput = (DATA_SIZE / (encryptTime / 1000000000.0)) / (1024.0 * 1024.0);
 
         String testName = String.format("%s (%s)", cipherName, providerName);
-        System.out.printf("| %-40s | %8.3f | %8.3f | %8.3f |%n",
+        System.out.printf(" %-40s  %8.3f MiB %8.3f ms %8.3f MiB/s%n",
           testName + " enc", dataSizeMiB, encryptTimeMS, encryptThroughput);
 
         results.add(new BenchmarkResult(providerName, cipherName + " enc", encryptThroughput));
@@ -240,8 +240,8 @@ private static void runEncDecBenchmark(String algorithm, String mode, String pad
         decryptTimeMS = decryptTime / 1000000.0;
         decryptThroughput = (DATA_SIZE / (decryptTime / 1000000000.0)) / (1024.0 * 1024.0);
 
-        System.out.printf("| %-40s | %8.3f | %8.3f | %8.3f |%n",
-          testName + " dec", dataSizeMiB, decryptTimeMS, decryptThroughput);
+        System.out.printf(" %-40s  %8.3f MiB %8.3f ms %8.3f MiB/s%n",
+          testName + " dec", dataSizeMiB , decryptTimeMS, decryptThroughput);
 
         /* Store decryption result */
         results.add(new BenchmarkResult(providerName, cipherName + " dec", decryptThroughput));
@@ -260,7 +260,7 @@ private static void printRSAResults(int operations, double totalTime, String ope
 
         /* Print formatted results */
         System.out.printf("%-12s  %-8s %8d ops took %.3f sec, avg %.3f ms, %.3f ops/sec%n",
-            operation,
+            operation + " (" + mode + ")",
             " ",
             operations,
             totalTime,
@@ -268,7 +268,7 @@ private static void printRSAResults(int operations, double totalTime, String ope
             opsPerSec);
 
         /* Store results for delta table */
-        String fullOperation = String.format("%s (%s)", operation, mode);
+        String fullOperation = operation; // Remove the mode from here since it's already included in the operation
         results.add(new BenchmarkResult(providerName, fullOperation, opsPerSec));
     }
 
@@ -383,9 +383,7 @@ public static void main(String[] args) {
 
             System.out.println("-----------------------------------------------------------------------------");
             System.out.println(" Symmetric Cipher Benchmark");
-            System.out.println("-----------------------------------------------------------------------------");
-            System.out.println("| Operation                                | Size MiB |    ms    |   MiB/s  |");
-            System.out.println("|------------------------------------------|----------|----------|----------|");
+            System.out.println("-----------------------------------------------------------------------------\n");
 
             /* Run symmetric benchmarks */
             for (int i = 0; i < providers.length; i++) {
@@ -399,17 +397,13 @@ public static void main(String[] args) {
                     runEncDecBenchmark("DESede", "CBC", "NoPadding", providerNames[i]);
                 }
 
-                if (i < providers.length - 1) {
-                    System.out.println("|------------------------------------------|----------|----------|----------|");
-                }
-
                 Security.removeProvider(providers[i].getName());
             }
 
-            System.out.println("-----------------------------------------------------------------------------");
 
             /* Run RSA benchmarks */
-            System.out.println("\nRSA Benchmark Results");
+            System.out.println("\n-----------------------------------------------------------------------------");
+            System.out.println("RSA Benchmark Results");
             System.out.println("-----------------------------------------------------------------------------");
 
             for (Provider provider : providers) {