Commit 1369d029 authored by Hoang Gia NGUYEN's avatar Hoang Gia NGUYEN
Browse files

testing

parent d4e94487

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.
1.1,1.2,1.3
2.1,2.2,2.3
3.1,3.2,3.3
\ No newline at end of file
4,1,9
5,9,3
8,5,9
\ No newline at end of file
6,0,9
1,8,5
9,4,5
\ No newline at end of file
7,6,7,2,7,2,7,7,3,3,8,3,7,7,4,1,4,2,6,9,6,6,9,2,2
8,8,9,9,8,9,2,0,7,5,2,2,8,8,9,1,3,1,3,9,8,8,1,1,0
4,6,3,2,2,5,4,7,4,9,4,2,5,2,4,0,9,8,9,5,3,9,4,2,7
1,3,7,0,8,6,3,8,3,5,8,3,9,6,3,8,6,3,8,9,9,3,3,4,1
3,7,1,0,0,4,6,9,0,9,9,4,1,6,0,8,3,0,1,0,9,0,8,2,9
2,4,5,5,2,3,7,4,6,0,6,3,6,8,6,7,8,7,7,9,9,8,9,4,8
4,4,6,4,4,0,0,5,0,3,1,3,0,4,1,1,1,9,0,4,3,2,3,4,4
5,0,5,7,1,3,1,7,8,7,2,5,6,4,1,4,0,4,1,4,1,8,3,7,4
2,8,8,6,6,6,8,8,0,1,4,6,1,0,4,8,1,5,6,4,1,9,9,5,1
1,6,1,2,0,3,3,4,2,4,9,6,3,8,6,8,3,2,5,6,5,9,0,8,9
7,9,6,3,6,3,0,9,5,8,2,0,9,2,3,1,7,2,4,9,1,1,9,9,6
3,9,6,5,9,6,5,1,2,2,7,6,3,5,1,6,4,7,0,0,0,8,0,8,2
7,8,2,9,0,0,2,8,3,6,6,7,7,0,9,6,1,9,8,8,1,3,2,7,6
0,9,8,0,2,0,8,7,1,6,8,3,3,6,3,5,5,5,1,8,6,6,5,5,5
7,9,1,3,1,4,9,8,8,8,0,9,2,0,6,0,3,7,0,6,9,8,4,2,7
6,0,3,7,7,9,8,8,1,5,4,8,7,4,9,7,7,4,4,4,2,0,3,1,8
0,6,6,1,5,9,7,2,8,8,3,8,6,7,8,1,8,0,0,5,9,7,1,4,7
9,8,6,7,9,6,1,5,3,6,1,8,6,5,1,4,2,9,0,8,8,1,9,0,3
2,0,6,1,6,7,7,4,7,3,7,9,6,6,3,2,3,1,7,0,6,7,1,2,5
2,1,4,1,0,1,7,4,2,1,5,8,2,9,4,9,8,8,0,3,9,8,1,4,5
7,2,4,9,5,0,5,9,1,3,0,3,9,6,9,7,6,6,3,6,0,4,9,7,6
8,8,5,7,9,0,6,2,2,3,1,1,7,2,2,0,2,5,1,3,9,5,3,3,6
1,7,0,2,2,0,1,5,3,0,7,7,8,9,6,8,9,2,0,6,7,9,8,4,8
5,3,3,5,7,2,5,0,6,5,1,5,1,6,6,8,2,9,5,7,1,1,5,1,3
3,1,0,1,6,9,2,2,9,7,0,8,8,7,7,7,7,8,6,3,0,0,5,5,9
\ No newline at end of file
1.1,2.1,3.1,4.1,5.1,6.1,7.1,8.1,9.1,10.1,11.1,12.1,13.1,14.1,15.1,16.1,17.1,18.1,19.1,20.1,21.1,22.1,23.1,24.1,25.1
\ No newline at end of file
mkdir -p keys/
mkdir -p lcheck/
mkdir -p parent/
mkdir -p result/
# rm ls.txt
# bash data_creating.sh 0 99 9 1000
# Number of driving licenses, eg: (0..99)
min=0
max=101
# max=1631
# max=101
# sim: (eval: 0.465s, 0.488s, 0.480s decrypt: 0.028s, 0.080s, 0.077s)
# seq: (eval: 0.xxx, 0.xxx, 0.xxx decrypt: 0.xxx, 0.xxx, 0.xxx)
# max=203
# (eval: 3.635s, 3.510s, 3.628s decrypt: 0.062s, 0.153s. 0.134s)
# seq: (eval: 0.xxx, 0.xxx, 0.xxx decrypt: 0.xxx, 0.xxx, 0.xxx)
# max=407
# (eval: 38.607s, 39.600s, 39.565s decrypt: 0.264s, 0.260s, 0.245s)
# seq: (eval: 0.xxx, 0.xxx, 0.xxx decrypt: 0.xxx, 0.xxx, 0.xxx)
# max=815
# (eval: x decrypt: x )
# Number of chars/words of a driving license, eg: 9
n_char=39
# Encrypted number range, eg: 10, 100, 1000 for 1 2 3 4 digits
range=255
# (8-bit)
# sampling size
sample=40
CURR_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# Note
# gen keys
# ./ANN_genkey_v1 keys/
${CURR_DIR}/ANN_genkey_v1 keys/
line=$((RANDOM %max))
lcheck=""
# gen data
for i in $(seq $min $max)
do
mkdir -p parent/l"$i"/
echo "Created folder $i"
value=""
for j in $(seq 0 $n_char)
do
value+="$((RANDOM %$range)) "
done
echo $value
echo $value >> ls.txt
# ./ANN_encrypt_v1 "$value" "l" parent/l"$i"/ $sample keys/
${CURR_DIR}/ANN_encrypt_v1 "$value" "l" parent/l"$i"/ $sample keys/
if [[ "$line" -eq "$i" ]]
then
lcheck="$value"
fi
done
# get random lc
# lcheck=$(sed -n "$((RANDOM %9){p;q}" ls.txt)
# line=$((RANDOM %max))
# lcheck="$(sed -n "${line}{p;q}" ls.txt)"
echo "Pick up license to check: $lcheck"
# ./ANN_encrypt_v1 "$lcheck" "l" lcheck/ $sample keys/
${CURR_DIR}/ANN_encrypt_v1 "$lcheck" "l" lcheck/ $sample keys/
# ./ANN_encrypt "47 25 76 23 30 21 1 47 88 3" "a" keys/bfv.pk lcheck/
# eval
value1="lcheck/l.ct "
value2=""
for i in $(seq 0 $max)
do
value2+="parent/l${i}/l.ct "
done
# value2="${value1} ${value2}"
value3="$value1$value2"
echo "$value3"
# time ./ANN_evaluate_v1 $value3 "l" result/ $sample keys/
# ./ANN_evaluate_v1 $value3 "l" result/ $sample keys/
time ${CURR_DIR}/ANN_evaluate_v1 $value3 "l" result/ $sample keys/
echo ""
# time ./ANN_decrypt_result_v1 result/l.ct $sample keys/
# ./ANN_decrypt_result_v1 result/l.ct $sample keys/
${CURR_DIR}/ANN_decrypt_result_v1 result/l.ct $sample keys/
# rm -r keys/*
# rm -r lcheck/*
# rm -r parent/*
# rm -r result/*
# rm ls.txt
This diff is collapsed.
This diff is collapsed.
#ifndef _UTIL_H_
#define _UTIL_H_
#include <string>
#include <vector>
// int findNumberOfFilesInDirectory(const std::string &path);
bool sub_str_exist(const std::string &str, const std::string &sub_str);
// std::vector<std::string> get_directories(const std::string &s);
// std::vector<std::string> get_directories_deep(const std::string &s);
#endif
This diff is collapsed.
This diff is collapsed.
#!/bin/bash
#
# 2020 CEA LIST.
declare -r ERROR_NUMBER_PARAM=1
declare -r ERROR_KEY_NOT_FOUND=3
declare -r KEYGEN_NOT_PERFORMED=4
#/opt/seal/native/bin
# /opt/pki/seal/
# /opt/pki/seal/natives/examples/generic
CURR_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
# params executable seal_generic_encrypt
# value
# path_to_key existing key pk encrypt
if [ "$#" -ne 1 ]; then
echo "You must enter exactly 1 command line arguments"
# display help if empty
echo " path to sk , "
exit $ERROR_NUMBER_PARAM
fi
path_to_key=$1
# encryption
echo "key generation"
${CURR_DIR}/generic_genkey $path_to_key
# recuperate result
if [ "$?" == "0" ]; then
echo ok done
else
echo KEYGEN_NOT_PERFORMED
exit 4
fi
exit
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment