Code base obscuration (for images) 1.0
It implements different obscuration methods on portable images (.pgm and .ppm)
|
Functions | |
avg_curve_mod_k_by_r_value (t_pix_enc, vector_r_values, n, size_vec_r, p, q) | |
According to r value. | |
avg_curve_mod_k_by_r_value_inv (t_pix_enc, vector_r_values, n, size_vec_r, p, q) | |
This function calculates and plots the average curve of encrypted pixels modulo k by r value for inverse encryption. | |
avg_curve_mod_k_by_pixel_value (t_pix_enc, vector_r_values, n, size_vec_r, p, q, inverse, g) | |
According to initial pixel value. | |
avg_curve_mod_2_by_pixel_value (t_pix_enc, vector_r_values, n, size_vec_r, title) | |
According to initial pixel value with differents modulo. | |
avg_curve_mod_4_by_pixel_value (t_pix_enc, vector_r_values, n, size_vec_r, title) | |
This function calculates and plots the average curve of encrypted pixels modulo 4 by pixel value. | |
avg_curve_mod_k_by_pixel_value_in_common (t_pix_enc, t_pix_inv_enc, vector_r_values, n, size_vec_r, p, q, g) | |
According to initial pixel value, with different modulo, with common values where there is no r value for modulo k = 0. | |
traiterResultats (f_pix, p, q) | |
This function processes the results and plots various curves. | |
main () | |
The main function that processes all result files in a directory. | |
Variables | |
f_pix = open(f_pix, "r") | |
Initialisation, get data. | |
int | p = 13 |
int | q = 19 |
lines_pix = f_pix.readlines() | |
list | t_pix_avg = [] |
list | count_pix = [] |
g = int(lines_pix[0]) | |
n = int(lines_pix[1]) | |
size_vec_r = int(lines_pix[2]) | |
list | vector_r_values = [] |
list | t_pix_enc = [] |
int | line_index = 3 |
r_value = np.uint64(lines_pix[line_index].strip()) | |
list | t_pix_enc_row = [] |
pix_value = np.uint16(lines_pix[line_index].strip()) | |
list | t_pix_enc_inv = [] |
Curves. | |
list | t_pix_enc_inv_row = [] |
x = np.invert(np.array(t_pix_enc[i][j], dtype=np.uint16)) | |
Paillier_stats_on_g.avg_curve_mod_2_by_pixel_value | ( | t_pix_enc, | |
vector_r_values, | |||
n, | |||
size_vec_r, | |||
title ) |
According to initial pixel value with differents modulo.
This function calculates and plots the average curve of encrypted pixels modulo 2 by pixel value.
t_pix_enc | A 2D list containing encrypted pixel values. |
vector_r_values | A list containing r values. |
n | The number of pixels. |
size_vec_r | The size of the r value vector. |
title | The title of the plot. |
Paillier_stats_on_g.avg_curve_mod_4_by_pixel_value | ( | t_pix_enc, | |
vector_r_values, | |||
n, | |||
size_vec_r, | |||
title ) |
This function calculates and plots the average curve of encrypted pixels modulo 4 by pixel value.
t_pix_enc | A 2D list containing encrypted pixel values. |
vector_r_values | A list containing r values. |
n | The number of pixels. |
size_vec_r | The size of the r value vector. |
title | The title of the plot. |
Paillier_stats_on_g.avg_curve_mod_k_by_pixel_value | ( | t_pix_enc, | |
vector_r_values, | |||
n, | |||
size_vec_r, | |||
p, | |||
q, | |||
inverse, | |||
g ) |
According to initial pixel value.
This function calculates and plots the average curve of encrypted pixels modulo k by pixel value.
t_pix_enc | A 2D list containing encrypted pixel values. |
vector_r_values | A list containing r values. |
n | The number of pixels. |
size_vec_r | The size of the r value vector. |
p | A prime number used in Paillier encryption. |
q | Another prime number used in Paillier encryption. |
inverse | A boolean value indicating whether to use inverse encryption or not. |
g | A value used in Paillier encryption. |
Paillier_stats_on_g.avg_curve_mod_k_by_pixel_value_in_common | ( | t_pix_enc, | |
t_pix_inv_enc, | |||
vector_r_values, | |||
n, | |||
size_vec_r, | |||
p, | |||
q, | |||
g ) |
According to initial pixel value, with different modulo, with common values where there is no r value for modulo k = 0.
This function calculates and plots the average curve of encrypted pixels modulo k by pixel value for common values.
t_pix_enc | A 2D list containing encrypted pixel values. |
t_pix_inv_enc | A 2D list containing inversely encrypted pixel values. |
vector_r_values | A list containing r values. |
n | The number of pixels. |
size_vec_r | The size of the r value vector. |
p | A prime number used in Paillier encryption. |
q | Another prime number used in Paillier encryption. |
g | A value used in Paillier encryption. |
Paillier_stats_on_g.avg_curve_mod_k_by_r_value | ( | t_pix_enc, | |
vector_r_values, | |||
n, | |||
size_vec_r, | |||
p, | |||
q ) |
According to r value.
This function calculates and plots the average curve of encrypted pixels modulo k by r value.
t_pix_enc | A 2D list containing encrypted pixel values. |
vector_r_values | A list containing r values. |
n | The number of pixels. |
size_vec_r | The size of the r value vector. |
p | A prime number used in Paillier encryption. |
q | Another prime number used in Paillier encryption. |
Paillier_stats_on_g.avg_curve_mod_k_by_r_value_inv | ( | t_pix_enc, | |
vector_r_values, | |||
n, | |||
size_vec_r, | |||
p, | |||
q ) |
This function calculates and plots the average curve of encrypted pixels modulo k by r value for inverse encryption.
t_pix_enc | A 2D list containing encrypted pixel values. |
vector_r_values | A list containing r values. |
n | The number of pixels. |
size_vec_r | The size of the r value vector. |
p | A prime number used in Paillier encryption. |
q | Another prime number used in Paillier encryption. |
Paillier_stats_on_g.main | ( | ) |
The main function that processes all result files in a directory.
Paillier_stats_on_g.traiterResultats | ( | f_pix, | |
p, | |||
q ) |
list Paillier_stats_on_g.count_pix = [] |
Paillier_stats_on_g.f_pix = open(f_pix, "r") |
Initialisation, get data.
Paillier_stats_on_g.g = int(lines_pix[0]) |
int Paillier_stats_on_g.line_index = 3 |
Paillier_stats_on_g.lines_pix = f_pix.readlines() |
Paillier_stats_on_g.n = int(lines_pix[1]) |
int Paillier_stats_on_g.p = 13 |
Paillier_stats_on_g.pix_value = np.uint16(lines_pix[line_index].strip()) |
int Paillier_stats_on_g.q = 19 |
Paillier_stats_on_g.r_value = np.uint64(lines_pix[line_index].strip()) |
Paillier_stats_on_g.size_vec_r = int(lines_pix[2]) |
list Paillier_stats_on_g.t_pix_avg = [] |
list Paillier_stats_on_g.t_pix_enc = [] |
list Paillier_stats_on_g.t_pix_enc_inv = [] |
Curves.
list Paillier_stats_on_g.t_pix_enc_inv_row = [] |
list Paillier_stats_on_g.t_pix_enc_row = [] |
list Paillier_stats_on_g.vector_r_values = [] |
Paillier_stats_on_g.x = np.invert(np.array(t_pix_enc[i][j], dtype=np.uint16)) |