diff --git a/README.md b/README.md
index 445338c721008f6f2ea5b7a2c7e032403b9ba26e..bd36905d35d4d3b28c2fc860be5cd1961093767d 100644
--- a/README.md
+++ b/README.md
@@ -1,92 +1,21 @@
 # TP_LibSodium_NaCl
 
+Ce travail pratique est composé de 2 parties:
 
+La première concernant les mots de passe se divise en 2 programmes
+1. un programme pour enregistrer un nom d'utilisateur et un mot de passe
+2. un programme pour vérifier la paire
 
-## Getting started
+Cette implémentation s'effectue à l'aide d'une base de données **SQLite 3**.
+Il faut en premier lieu s'assurer d'avoir un programme qui est mesure d'ouvrir une base de données SQLite, d'y écrire des tables et de lire/écrire des données
 
-To make it easy for you to get started with GitLab, here's a list of recommended next steps.
+Dans un deuxième temps il faut utiliser la librairie **Libsodium** et plus particulièrment l'API pwhash* dans le but de chiffrer, déchiffrer ou dans notre cas hacher un mot de passe.
 
-Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
+Les deux fonctions de hachage de mot de passe utilisées sont:
 
-## Add your files
+**1.** crypto_pwhash_str() qui permet de hacher un mot de passe avec: 
+* le résultat d'une fonction de hachage gourmande en mémoire et gourmande en CPU appliquée au mot de passe de longueur du mot de passe
+* le sel généré automatiquement utilisé pour le calcul précédent
+* les autres paramètres requis pour vérifier le mot de passe, y compris l'identifiant de l'algorithme, sa version, opslimit et memlimit
 
-- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
-- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
-
-```
-cd existing_repo
-git remote add origin https://gitedu.hesge.ch/kevineri.bonga/tp_libsodium_nacl.git
-git branch -M main
-git push -uf origin main
-```
-
-## Integrate with your tools
-
-- [ ] [Set up project integrations](https://gitedu.hesge.ch/kevineri.bonga/tp_libsodium_nacl/-/settings/integrations)
-
-## Collaborate with your team
-
-- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
-- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
-- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
-- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
-- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
-
-## Test and Deploy
-
-Use the built-in continuous integration in GitLab.
-
-- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
-- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
-- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
-- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
-- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
-
-***
-
-# Editing this README
-
-When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!).  Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
-
-## Suggestions for a good README
-Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
-
-## Name
-Choose a self-explaining name for your project.
-
-## Description
-Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
-
-## Badges
-On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
-
-## Visuals
-Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
-
-## Installation
-Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
-
-## Usage
-Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
-
-## Support
-Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
-
-## Roadmap
-If you have ideas for releases in the future, it is a good idea to list them in the README.
-
-## Contributing
-State if you are open to contributions and what your requirements are for accepting them.
-
-For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
-
-You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
-
-## Authors and acknowledgment
-Show your appreciation to those who have contributed to the project.
-
-## License
-For open source projects, say how it is licensed.
-
-## Project status
-If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.
+**2.** crypto_pwhash_str_verify() qui vérifie qu'une chaîne de caractère est une chaîne de vérification de mot de passe valide (telle que générée par crypto_pwhash_str()) pour un mot de passe dont la longueur est la longueur du mot de passe.
diff --git a/mosaique.txt b/mosaique.txt
new file mode 100644
index 0000000000000000000000000000000000000000..bebdff185048a3d7e5b53b5a100ebe8f4709ad27
--- /dev/null
+++ b/mosaique.txt
@@ -0,0 +1,109 @@
+Me d'mandez pas c'que j'fais dans la vie
+C'est si noir, vous s'rez pris de panique
+Quelque part, loin de toute compagnie
+Batterie Faible m'a fait perdre beaucoup d'amis
+Me serre pas la main, fais-moi un #Vie
+J'attends la mort comme en Gethsémani
+Baise-la c'est tout sinon elle f'ra des manies
+Elle manqua d'respect à ta famille
+Une seule erreur et t'as plus d'followers
+Donc j'fais c'que j'aime, non pas c'que l'on me dit
+J'suis toujours debout, tombé du lit
+Vu du ciel, l'Enfer est comme le Paradis
+"Crève dans ta merde, t'auras pas un radis"
+C'est à peu près ce que le daron m'a dit
+Heureusement gros culs ont su consoler
+De leurs 'ttes-cha j'me suis empoisonné
+J'ai picolé, j'ai bu oui, j'ai bu oui
+J'perds la raison à cause de mes torts
+C'est ça qu'ça fait d'toujours bosser la nuit
+J'fume de trop, j'fais plus de sport
+"C'est pas très bon", m'a dit coach Elie
+Drogue dans la soute, à peine j'atterris
+J'roule un doobie, oh oui
+Ils ne me veulent pas du bien, no
+Ils ne me veulent pas du bien, no
+Ils font bonhomme de neige
+J'ai fait bonhomme de chemin
+Ils ne me veulent pas du bien, no
+Ils ne me veulent pas du bien, no
+J'suis sorti de la dèch'
+Vie en rose comme schneck de tchoin
+Fiancé à la vulgarité
+J'ai renoncé à la précarité
+J'ai mis mes chances dans le barillet
+J'ai tiré sans jamais m'arrêter
+Rosemark s'tu veux qualité
+Grosses liasses, la mentalité
+Plus d'sable dans le sablier
+Plus d'place dans le paradise
+Damsolitaire
+Oh
+Dams
+Sale, sale, sale (that I used to say)
+Oh oui, oh oui, oh oui, oh oui, oh oui, oh oui (that I used to say)
+Ils ne me veulent pas du bien, no
+Ils ne me veulent pas du bien, no
+Ils font bonhomme de neige
+J'ai fait bonhomme de chemin
+Ils ne me veulent pas du bien, no
+Ils ne me veulent pas du bien, no
+J'suis sorti de la dèch'
+Vie en rose comme schneck de tchoin
+Fiancé à la vulgarité
+J'ai renoncé à la précarité
+J'ai mis mes chances dans le barillet
+J'ai tiré sans jamais m'arrêter
+Rosemark s'tu veux qualité
+Grosses liasses, la mentalité
+Plus d'sable dans le sablier
+Plus d'place dans le paradise
+Des blèmes-pro, fils y en aura toujours
+La police piste nos phones-tel
+Du mal à appréhender l'futur car dans ma vision j'suis immortel
+Plus d'sept mille jours que j'suis né
+Dont au moins mille passés à fumer
+Fumer tue, vivre aussi, dans l'temps qu'il y a faire autant se ruiner
+J'n'ai rien à perdre en soi
+Vu qu'on n'emporte rien avec soi
+Ne dis pas "j't'aime" quand tu me vois
+Viens pas dans mon lit mais sous ma ble-ta
+Pourquoi j'suis comme ça? M'le demandez pas
+J'saurais pas trop quoi vous répondre
+Faut pas vous méprendre, j'prend tous c'que je peux prendre
+Comme ma terre, j'suis riche que sous les décombres
+Je pleure que de l'intérieur pour que mes soucis se noient
+Pourquoi leur demander l'heure?
+J'sais bien qu'la mienne n'est pas encore là
+Diplômé, riche et après?
+J'regrette la cour de récré, mais pas l'temps pour les regrets m'a dit mon cœur
+Nostalgique car présent pas à la hauteur
+Ma sueur vient que de l'effort, le stress me sert de décor
+J'm'en bats tellement les illes-cou
+Désinvolture recouvre mes pores, rêve mais ne dors pas
+Crève mais ne meurs pas, à chaque fois je mords
+La java je sors la vertu d'une burqa
+Rapper c'est c'que j'sais faire de mieux
+Casser la gueule des racistes aussi
+Toujours un couteau dans l'sac pour mieux
+Cadrer l'ennemi pour qu'il soit plus docile
+En chacun d'nous habite Dieu qu'il m'dit
+Sa maison s'trouve dans nos cœurs qu'il m'dit
+Donc, excusez-moi Seigneur j'lui dis
+Si mes poumons sentent trop la beuh
+J'passe mon temps à rêver d'prendre l'air, putain de merde
+Larges baies vitrées, bureaux, phones, secrétaires
+Équivaut réussite urbaine sur la Terre
+J'serais rappeur plus tard maman faut pas t'en faire
+J'gagnerai des grosses thunes en disques et concerts
+J'crois qu'ça va t'plaire, j'f'rai l'tour de la Terre
+J'éclaterai barreaux d'la vie pour qu'on se libère
+Là j'avance, j'pense accident cardio-vasculaire
+Triste d'être célèbre mais sans peur énumère
+Mes ennemis prennent cher
+J'digère rien, ma bile sort jamais d'sa vésicule biliaire
+D'vant l'évangéliaire, je cite quelques prières
+Peu précédé par folie meurtrière
+M'sieur l'abbé, ma haine ne date pas d'hier
+Je suis donc je reste suite logique des auxiliaires
+Damso
\ No newline at end of file
diff --git a/tp_crypto.db b/tp_crypto.db
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/tp_part_doc.c b/tp_part_doc.c
new file mode 100644
index 0000000000000000000000000000000000000000..b84076623651dad05b8e92509887fe133a9a71eb
--- /dev/null
+++ b/tp_part_doc.c
@@ -0,0 +1,85 @@
+#include <stdio.h>
+#include "stdlib.h"
+#include <sqlite3.h>
+#include <string.h>
+#include <stdbool.h>
+
+int read_file(char * filename, FILE* fid) {
+    fid = fopen(filename, "r"); // ouverture du fichier;
+    if (fid == NULL) {
+        printf("Le fichier n'a pas pu être ouvert");
+        return 1;
+    }
+    return 0;
+}
+
+unsigned char * file_datas(char filename[], unsigned long * data_length)
+{
+    FILE * fid = NULL;
+    unsigned char * file_data = NULL;
+    if(read_file(filename, fid)==0)
+    {
+        fseek(fid, 0, SEEK_END);
+        *data_length = ftell(fid);
+        fseek(fid, 0, SEEK_SET);
+        file_data = malloc(*data_length);
+        if (file_data)
+            fread(file_data, 1, *data_length, fid);
+    }
+    fclose(fid);
+    return file_data;
+}
+
+bool check_file(sqlite3 * db)
+{
+    sqlite3_stmt * stmt;
+    char directory[60];
+    char * qry_directory = "SELECT DIRECTORY from FILES where DIRECTORY = '";
+    scanf("%s", directory);
+    char* res_1= strcat(qry_directory,directory);
+    char * end_qry = "';";
+    char * res_2 = strcat(res_1, end_qry);
+
+    int rc = sqlite3_prepare_v2(db, res_2, -1, &stmt, 0);
+    if(rc == SQLITE_OK){
+        int idx = sqlite3_bind_parameter_index(stmt, directory);
+        sqlite3_bind_text(stmt, idx, directory, -1, SQLITE_TRANSIENT);
+        int step = sqlite3_step(stmt);
+        if(step == SQLITE_ROW){
+            sqlite3_finalize(stmt);
+            return true;
+        }
+    }
+    sqlite3_finalize(stmt);
+    return false;
+}
+
+int crypto_values(sqlite3 * db, char directory[]){
+    sqlite3_stmt * stmt;
+    char * qry_crypto = "SELECT PUB_KEY, SIGNATURE from T_FILES where DIRECTORY = '";
+    char * res_1= strcat(qry_crypto, directory);
+    char * end_qry="';";
+    char * res_2 = strcat(res_1,end_qry);
+    int rc = sqlite3_prepare_v2(db, res_2, -1, &stmt, 0);
+    if (rc!=SQLITE_OK)
+        return 1;
+    else {
+        int idx = sqlite3_bind_parameter_index(stmt, directory);
+        sqlite3_bind_text(stmt, idx, directory, -1, SQLITE_TRANSIENT);
+        int step = sqlite3_step(stmt);
+        if(step == SQLITE_ROW){
+        }
+    }
+    sqlite3_finalize(stmt);
+    return 0;
+}
+
+int main(){
+    sqlite3 *db;
+    sqlite3_stmt * stmt;
+
+    sqlite3_finalize(stmt);
+    sqlite3_close(db);
+    return 0;
+
+}
\ No newline at end of file
diff --git a/tp_part_pwd.c b/tp_part_pwd.c
new file mode 100644
index 0000000000000000000000000000000000000000..3d8e6e999668683a35b6d6a7c275eac44e823627
--- /dev/null
+++ b/tp_part_pwd.c
@@ -0,0 +1,134 @@
+#include <stdio.h>
+#include <sqlite3.h>
+#include <string.h>
+#include <sodium/crypto_pwhash.h>
+#include <stdbool.h>
+
+#define PASSWORD "Correct Horse Battery Staple"
+
+char hashed_password[crypto_pwhash_STRBYTES];
+
+void hashed_pwd(){
+    if (crypto_pwhash_str(hashed_password, PASSWORD, strlen(PASSWORD),
+                 crypto_pwhash_OPSLIMIT_SENSITIVE, crypto_pwhash_MEMLIMIT_SENSITIVE) != 0) {
+/* out of memory*/
+    }
+
+    if (crypto_pwhash_str_verify
+                (hashed_password, PASSWORD, strlen(PASSWORD)) != 0) {
+/* wrong password*/
+    }
+}
+
+int add_user(sqlite3 * db){
+    char user_name[255];
+    char pwd[255];
+    char *err;
+    char* qry="insert into user VALUES ('";
+    char* middle="','";
+
+    printf("Veuillez introduire un nom d'utilisateur\n"); scanf("%s",&user_name);
+    printf("Veuillez introduire votre mot de passe\n"); scanf("%s",&pwd);
+
+    if (crypto_pwhash_str
+        (&hashed_password[crypto_pwhash_STRBYTES], pwd, strlen(pwd),
+         crypto_pwhash_OPSLIMIT_MODERATE, crypto_pwhash_MEMLIMIT_MODERATE) != 0){
+            printf("Erreur (out of memory)\n");
+            return 1;
+        }
+
+    char* res_1=strcat(qry,user_name); char* res_2= strcat(res_1,middle); char * res_3= strcat(res_2,pwd);
+    char* endqry="');";
+    char* query = strcat(res_3, endqry);
+    int rc = sqlite3_exec(db, query, NULL, NULL, &err);
+    if(rc != SQLITE_OK){
+        //cout << "error: " << err;
+        printf("Erreur d'insertion\n");
+        return 1;
+    }
+    return 0;
+}
+
+bool check_user(sqlite3 * db, char user_name[]) {
+    char *name_req = "select name from personne where name='";
+    char *name_req_res1 = strcat(name_req, user_name);
+    char *endqry = "';";
+    char *err;
+    char *name_req_res2 = strcat(name_req_res1, endqry);
+
+    int rc = sqlite3_exec(db, name_req_res2, NULL, NULL, &err);
+    if (rc != SQLITE_OK) {
+        while (rc != SQLITE_OK) {
+            printf("Nom d'utilisateur inconnu\nVeuillez introduire nom d'utilisateur\n");
+            scanf("%s", user_name);
+            name_req_res1 = strcat(name_req, user_name);
+            name_req_res2 = strcat(name_req_res1, endqry);
+            rc = sqlite3_exec(db, name_req_res2, NULL, NULL, &err);
+        }
+    }
+    return true;
+}
+
+int login(sqlite3 * db, sqlite3_stmt * stmt, char name[]){
+    char pwd[255];
+    int cpt=3;
+    char *endqry = "';";
+
+    char* qry = "select usr_pwd from personne where name='";
+
+    char* res_1= strcat(qry,name);
+    char * query = strcat(res_1, endqry);
+
+    sqlite3_prepare_v2(db, query,-1, &stmt, 0);
+
+    sqlite3_column_text(stmt, 1);
+    if (crypto_pwhash_str_verify
+                (hashed_password, pwd, strlen(pwd)) != 0) {
+        printf("Mot de passe erroné\nVeuillez introduire votre mot de passe\n");
+
+        scanf("%s",&pwd);
+        cpt--;
+        if (cpt==0){
+            printf("Nombre de tentatives de mot de passe dépassé\n");
+            return 1;
+        }
+    }
+    printf("acces granted, welcome user\n");
+    return 0;
+    }
+
+void usr_interface(sqlite3 *db, sqlite3_stmt * stmt){
+    char input_user;
+    char usr_name[255];
+    printf("Posséder vous déjà un identifiant ?\ny/n");
+    scanf("%c",&input_user);
+    if(input_user=='y'){
+        scanf("%s",usr_name);
+        check_user(db, usr_name);
+        login(db, stmt, usr_name);
+    }
+    else if(input_user=='n') {
+        int add = add_user(db);
+        while (add!=0){
+            add=add_user(db);
+        }
+    }
+}
+
+int main() {
+    sqlite3 *db;
+    sqlite3_stmt * stmt;
+    char* err;
+    sqlite3_open("tp_crypto.db",&db);
+
+    int rc = sqlite3_exec(db, "CREATE TABLE IF NOT EXISTS user(usr_name varchar(255), usr_pwd varchar(255))", NULL, NULL, &err);
+    if(rc != SQLITE_OK){
+        //cout << "error: " << err;
+        printf("Erreur liée à la db\n");
+    }
+    usr_interface(db, stmt);
+
+    sqlite3_finalize(stmt);
+    sqlite3_close(db);
+    return 0;
+}