Skip to content

Commit

Permalink
Comments fixed as well as logic to not run DES test if it isn't detected
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack Tjaden committed Jan 10, 2025
1 parent db6b454 commit 0ad0fbd
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/provider/CryptoBenchmark.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ public class CryptoBenchmark {
private static final int AES_BLOCK_SIZE = 16;
private static final int DES3_BLOCK_SIZE = 8;
private static final int GCM_TAG_LENGTH = 128;
private static final int AES_KEY_SIZE = 256;
private static final int DES3_KEY_SIZE = 168;

// Class to store benchmark results
/* Class to store benchmark results */
private static class BenchmarkResult {
/* Result fields */
Expand Down Expand Up @@ -224,7 +221,7 @@ private static void runBenchmark(String algorithm, String mode, String padding,
System.out.printf("| %-40s | %8.3f | %8.3f | %8.3f |%n",
testName + " dec", dataSizeMiB, decryptTimeMS, decryptThroughput);

// Store decryption result
/* Store decryption result */
results.add(new BenchmarkResult(providerName, cipherName + " dec", decryptThroughput));
}

Expand All @@ -238,7 +235,7 @@ public static void main(String[] args) {
bcProvider = (Provider) bcClass.getDeclaredConstructor().newInstance();
hasBouncyCastle = true;
} catch (Exception e) {
// Bouncy Castle not available
/* Bouncy Castle not available */
}

/* Create provider list based on availability */
Expand Down Expand Up @@ -281,7 +278,10 @@ public static void main(String[] args) {
runBenchmark("AES", "CBC", "NoPadding", providerNames[i]);
runBenchmark("AES", "CBC", "PKCS5Padding", providerNames[i]);
runBenchmark("AES", "GCM", "NoPadding", providerNames[i]);
runBenchmark("DESede", "CBC", "NoPadding", providerNames[i]);
/* Only run DES3 benchmark if it's enabled */
if (FeatureDetect.Des3Enabled()) {
runBenchmark("DESede", "CBC", "NoPadding", providerNames[i]);
}

if (i < providers.length - 1) {
System.out.println("|------------------------------------------|----------|----------|----------|");
Expand Down

0 comments on commit 0ad0fbd

Please sign in to comment.