|
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 pixel values 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) | |
| According to initial pixel value. | |
| avg_curve_mod_2_by_pixel_value (t_pix_enc, vector_r_values, n, size_vec_r, title, inverse) | |
| 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, inverse) | |
| This function calculates and plots the average curve of encrypted pixel values modulo 4 by initial 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) | |
| According to initial pixel value, with different modulo, with common values where there is no r value for modulo k = 0. | |
| avg_curve_mod_k_by_pixel_value_and_lessthan_m (t_pix_enc, vector_r_values, n, size_vec_r, p, q, m, inverse) | |
| This function calculates and plots the average curve of encrypted pixel values modulo k by initial pixel value and less than 2^m. | |
| main () | |
| The main function that calls other functions to calculate and plot average curves of encrypted pixel values. | |
Variables | |
| f_pix = open("results_pix_p3q83nbR164.txt", "r") | |
| Initialisation, get data. | |
| int | p = 3 |
| int | q = 83 |
| lines_pix = f_pix.readlines() | |
| list | t_pix_avg = [] |
| list | count_pix = [] |
| n = int(lines_pix[0]) | |
| size_vec_r = int(lines_pix[1]) | |
| list | vector_r_values = [] |
| list | t_pix_enc = [] |
| int | line_index = 2 |
| 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_r.avg_curve_mod_2_by_pixel_value | ( | t_pix_enc, | |
| vector_r_values, | |||
| n, | |||
| size_vec_r, | |||
| title, | |||
| inverse ) |
According to initial pixel value with differents modulo.
This function calculates and plots the average curve of encrypted pixel values modulo 2 by initial 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. |
| inverse | A boolean value indicating whether to use inverse encryption or not. |
| Paillier_stats_on_r.avg_curve_mod_4_by_pixel_value | ( | t_pix_enc, | |
| vector_r_values, | |||
| n, | |||
| size_vec_r, | |||
| title, | |||
| inverse ) |
This function calculates and plots the average curve of encrypted pixel values modulo 4 by initial 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. |
| inverse | A boolean value indicating whether to use inverse encryption or not. |
| Paillier_stats_on_r.avg_curve_mod_k_by_pixel_value | ( | t_pix_enc, | |
| vector_r_values, | |||
| n, | |||
| size_vec_r, | |||
| p, | |||
| q, | |||
| inverse ) |
According to initial pixel value.
This function calculates and plots the average curve of encrypted pixel values modulo k by initial 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. |
| Paillier_stats_on_r.avg_curve_mod_k_by_pixel_value_and_lessthan_m | ( | t_pix_enc, | |
| vector_r_values, | |||
| n, | |||
| size_vec_r, | |||
| p, | |||
| q, | |||
| m, | |||
| inverse ) |
This function calculates and plots the average curve of encrypted pixel values modulo k by initial pixel value and less than 2^m.
| 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. |
| m | The exponent value of 2 for the threshold. |
| inverse | A boolean value indicating whether to use inverse encryption or not. |
| Paillier_stats_on_r.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 ) |
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 pixel values modulo k by initial pixel value for common values where there is no r value for modulo k = 0.
| 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. |
| Paillier_stats_on_r.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 pixel values 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_r.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 pixel values 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_r.main | ( | ) |
The main function that calls other functions to calculate and plot average curves of encrypted pixel values.
| list Paillier_stats_on_r.count_pix = [] |
| Paillier_stats_on_r.f_pix = open("results_pix_p3q83nbR164.txt", "r") |
Initialisation, get data.
| int Paillier_stats_on_r.line_index = 2 |
| Paillier_stats_on_r.lines_pix = f_pix.readlines() |
| Paillier_stats_on_r.n = int(lines_pix[0]) |
| int Paillier_stats_on_r.p = 3 |
| Paillier_stats_on_r.pix_value = np.uint16(lines_pix[line_index].strip()) |
| int Paillier_stats_on_r.q = 83 |
| Paillier_stats_on_r.r_value = np.uint64(lines_pix[line_index].strip()) |
| Paillier_stats_on_r.size_vec_r = int(lines_pix[1]) |
| list Paillier_stats_on_r.t_pix_avg = [] |
| list Paillier_stats_on_r.t_pix_enc = [] |
| list Paillier_stats_on_r.t_pix_enc_inv = [] |
Curves.
| list Paillier_stats_on_r.t_pix_enc_inv_row = [] |
| list Paillier_stats_on_r.t_pix_enc_row = [] |
| list Paillier_stats_on_r.vector_r_values = [] |
| Paillier_stats_on_r.x = np.invert(np.array(t_pix_enc[i][j], dtype=np.uint16)) |