🔐 Introduction

This report compares CRYSTALS-Kyber and ECC encryption algorithms across four critical performance metrics for Vehicle-to-Everything (V2X) communication in autonomous vehicles. It features both classical and interactive analysis, providing a dynamic exploration of encryption performance.


📥 Step 1: Load and View Dataset

V2X <- read_csv("V2X.csv")
## Rows: 500 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): Encryption_Type
## dbl (5): Message_ID, Latency_ms, Packet_Delivery_Ratio, Bandwidth_Overhead_P...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
str(V2X)
## spc_tbl_ [500 × 6] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ Message_ID                : num [1:500] 1 2 3 4 5 6 7 8 9 10 ...
##  $ Encryption_Type           : chr [1:500] "ECC" "CRYSTALS-Kyber" "ECC" "ECC" ...
##  $ Latency_ms                : num [1:500] 112.3 87.3 118.3 137.8 128.2 ...
##  $ Packet_Delivery_Ratio     : num [1:500] 94.1 95.3 90.9 95.5 88.8 ...
##  $ Bandwidth_Overhead_Percent: num [1:500] 19.1 18.1 18.2 15.3 16.8 ...
##  $ Energy_Consumption_Joules : num [1:500] 2.28 2.42 2.38 2.06 2.46 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   Message_ID = col_double(),
##   ..   Encryption_Type = col_character(),
##   ..   Latency_ms = col_double(),
##   ..   Packet_Delivery_Ratio = col_double(),
##   ..   Bandwidth_Overhead_Percent = col_double(),
##   ..   Energy_Consumption_Joules = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>
summary(V2X)
##    Message_ID    Encryption_Type      Latency_ms     Packet_Delivery_Ratio
##  Min.   :  1.0   Length:500         Min.   : 70.24   Min.   : 83.31       
##  1st Qu.:125.8   Class :character   1st Qu.:105.96   1st Qu.: 90.97       
##  Median :250.5   Mode  :character   Median :116.60   Median : 93.42       
##  Mean   :250.5                      Mean   :117.22   Mean   : 93.35       
##  3rd Qu.:375.2                      3rd Qu.:128.40   3rd Qu.: 95.48       
##  Max.   :500.0                      Max.   :182.79   Max.   :101.37       
##  Bandwidth_Overhead_Percent Energy_Consumption_Joules
##  Min.   :12.16              Min.   :1.294            
##  1st Qu.:17.60              1st Qu.:2.145            
##  Median :18.95              Median :2.356            
##  Mean   :19.15              Mean   :2.352            
##  3rd Qu.:20.78              3rd Qu.:2.558            
##  Max.   :26.39              Max.   :3.328
# Descriptive Summary Table
summary_stats <- data.frame(
  Metric = c("Latency (ms)", "Packet Delivery Ratio (%)", 
             "Bandwidth Overhead (%)", "Energy Consumption (Joules)"),
  Min = c(min(V2X$Latency_ms), 
          min(V2X$Packet_Delivery_Ratio), 
          min(V2X$Bandwidth_Overhead_Percent), 
          min(V2X$Energy_Consumption_Joules)),
  Q1 = c(quantile(V2X$Latency_ms, 0.25), 
         quantile(V2X$Packet_Delivery_Ratio, 0.25), 
         quantile(V2X$Bandwidth_Overhead_Percent, 0.25), 
         quantile(V2X$Energy_Consumption_Joules, 0.25)),
  Median = c(median(V2X$Latency_ms), 
             median(V2X$Packet_Delivery_Ratio), 
             median(V2X$Bandwidth_Overhead_Percent), 
             median(V2X$Energy_Consumption_Joules)),
  Mean = c(mean(V2X$Latency_ms), 
           mean(V2X$Packet_Delivery_Ratio), 
           mean(V2X$Bandwidth_Overhead_Percent), 
           mean(V2X$Energy_Consumption_Joules)),
  Q3 = c(quantile(V2X$Latency_ms, 0.75), 
         quantile(V2X$Packet_Delivery_Ratio, 0.75), 
         quantile(V2X$Bandwidth_Overhead_Percent, 0.75), 
         quantile(V2X$Energy_Consumption_Joules, 0.75)),
  Max = c(max(V2X$Latency_ms), 
          max(V2X$Packet_Delivery_Ratio), 
          max(V2X$Bandwidth_Overhead_Percent), 
          max(V2X$Energy_Consumption_Joules))
)

summary_stats %>%
  kbl(caption = "Descriptive Statistics for V2X Dataset") %>%
  kable_styling(full_width = FALSE, html_font = "Cambria")
Descriptive Statistics for V2X Dataset
Metric Min Q1 Median Mean Q3 Max
Latency (ms) 70.235453 105.962971 116.600712 117.218782 128.404595 182.790972
Packet Delivery Ratio (%) 83.311234 90.973589 93.422873 93.349843 95.478481 101.365900
Bandwidth Overhead (%) 12.157299 17.601664 18.946082 19.153582 20.777972 26.386215
Energy Consumption (Joules) 1.294146 2.145159 2.355709 2.352447 2.558356 3.327898

📊 Step 2: Summary Statistics by Encryption Type

summary_table <- V2X %>%
  group_by(Encryption_Type) %>%
  summarise(
    Mean_Latency = round(mean(Latency_ms), 2),
    SD_Latency = round(sd(Latency_ms), 2),
    Mean_PDR = round(mean(Packet_Delivery_Ratio), 2),
    SD_PDR = round(sd(Packet_Delivery_Ratio), 2),
    Mean_Bandwidth = round(mean(Bandwidth_Overhead_Percent), 2),
    SD_Bandwidth = round(sd(Bandwidth_Overhead_Percent), 2),
    Mean_Energy = round(mean(Energy_Consumption_Joules), 2),
    SD_Energy = round(sd(Energy_Consumption_Joules), 2)
  )

summary_table %>%
  kbl(caption = "Grouped Summary Statistics: Kyber vs ECC") %>%
  kable_classic(full_width = FALSE, html_font = "Cambria")
Grouped Summary Statistics: Kyber vs ECC
Encryption_Type Mean_Latency SD_Latency Mean_PDR SD_PDR Mean_Bandwidth SD_Bandwidth Mean_Energy SD_Energy
CRYSTALS-Kyber 109.83 15.02 94.36 3.00 20.26 2.06 2.5 0.28
ECC 124.97 15.26 92.29 2.93 17.99 1.93 2.2 0.30

📈 Step 3: Static Boxplot Comparisons

⏱️ Latency Comparison

ggplot(V2X, aes(x = Encryption_Type, y = Latency_ms, fill = Encryption_Type)) +
  geom_boxplot() +
  labs(title = "Latency Comparison", y = "Latency (ms)") +
  theme_minimal()

📦 Packet Delivery Ratio

ggplot(V2X, aes(x = Encryption_Type, y = Packet_Delivery_Ratio, fill = Encryption_Type)) +
  geom_boxplot() +
  labs(title = "Packet Delivery Ratio", y = "PDR (%)") +
  theme_minimal()

📶 Bandwidth Overhead

ggplot(V2X, aes(x = Encryption_Type, y = Bandwidth_Overhead_Percent, fill = Encryption_Type)) +
  geom_boxplot() +
  labs(title = "Bandwidth Overhead", y = "Overhead (%)") +
  theme_minimal()

⚡ Energy Consumption

ggplot(V2X, aes(x = Encryption_Type, y = Energy_Consumption_Joules, fill = Encryption_Type)) +
  geom_boxplot() +
  labs(title = "Energy Consumption", y = "Energy (Joules)") +
  theme_minimal()


📌 Key Findings

  • Kyber shows significantly lower latency and higher packet delivery reliability.
  • Slight increase in bandwidth and energy use, but within acceptable range.
  • Results support the hypothesis that Kyber is more suitable for quantum-resilient AV communications.

📈 Step 4: Interactive Analysis 🎯

📊 Dynamic Boxplots (Metric Selector)

library(tidyr)
## Warning: package 'tidyr' was built under R version 4.3.3
v2x_long <- V2X %>%
  pivot_longer(cols = c(Latency_ms, Packet_Delivery_Ratio, Bandwidth_Overhead_Percent, Energy_Consumption_Joules),
               names_to = "Metric", values_to = "Value")

plot_ly(data = v2x_long, x = ~Encryption_Type, y = ~Value, color = ~Encryption_Type,
        type = "box", facet_col = ~Metric) %>%
  layout(title = "Encryption Performance Comparison Across Metrics",
         yaxis = list(title = "Value"))
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning: 'box' objects don't have these attributes: 'facet_col'
## Valid attributes include:
## 'alignmentgroup', 'boxmean', 'boxpoints', 'customdata', 'customdatasrc', 'dx', 'dy', 'fillcolor', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hoveron', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'jitter', 'legendgroup', 'legendgrouptitle', 'legendrank', 'line', 'lowerfence', 'lowerfencesrc', 'marker', 'mean', 'meansrc', 'median', 'mediansrc', 'meta', 'metasrc', 'name', 'notched', 'notchspan', 'notchspansrc', 'notchwidth', 'offsetgroup', 'opacity', 'orientation', 'pointpos', 'q1', 'q1src', 'q3', 'q3src', 'quartilemethod', 'sd', 'sdsrc', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textsrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'upperfence', 'upperfencesrc', 'visible', 'whiskerwidth', 'width', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

## Warning: 'box' objects don't have these attributes: 'facet_col'
## Valid attributes include:
## 'alignmentgroup', 'boxmean', 'boxpoints', 'customdata', 'customdatasrc', 'dx', 'dy', 'fillcolor', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hoveron', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'jitter', 'legendgroup', 'legendgrouptitle', 'legendrank', 'line', 'lowerfence', 'lowerfencesrc', 'marker', 'mean', 'meansrc', 'median', 'mediansrc', 'meta', 'metasrc', 'name', 'notched', 'notchspan', 'notchspansrc', 'notchwidth', 'offsetgroup', 'opacity', 'orientation', 'pointpos', 'q1', 'q1src', 'q3', 'q3src', 'quartilemethod', 'sd', 'sdsrc', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textsrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'upperfence', 'upperfencesrc', 'visible', 'whiskerwidth', 'width', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

📋 Interactive Data Table

datatable(V2X, options = list(pageLength = 10, scrollX = TRUE),
          caption = "Full V2X Performance Dataset")

🔍 Hover-Based Insights (Latency vs Energy)

plot_ly(data = V2X, x = ~Latency_ms, y = ~Energy_Consumption_Joules, type = "scatter", mode = "markers",
        color = ~Encryption_Type, text = ~paste("PDR:", Packet_Delivery_Ratio),
        hoverinfo = "text+x+y") %>%
  layout(title = "Latency vs Energy Use (Hover to See PDR)",
         xaxis = list(title = "Latency (ms)"),
         yaxis = list(title = "Energy (Joules)"))
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels

📄 Conclusion

CRYSTALS-Kyber outperforms ECC in latency and reliability while maintaining acceptable trade-offs in bandwidth and energy use. These findings make Kyber a robust and future-ready encryption solution for Australian autonomous vehicle networks.