2019-06-30 17:49:20 +00:00
|
|
|
#ifndef ENCRYPT_H
|
|
|
|
#define ENCRYPT_H
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <cstring>
|
|
|
|
#include <iostream>
|
2019-07-02 18:40:37 +00:00
|
|
|
#include <sodium.h>
|
|
|
|
#include <string>
|
2019-06-30 17:49:20 +00:00
|
|
|
|
|
|
|
using std::string;
|
2019-07-02 18:40:37 +00:00
|
|
|
/*
|
|
|
|
hash_password takes the password, and encrypts it. This needs to be done,
|
2019-07-23 14:17:55 +00:00
|
|
|
because storing passwords in plaintext is BAD, no matter if it's just for a school project!
|
2019-07-02 18:40:37 +00:00
|
|
|
|
2019-07-08 20:57:09 +00:00
|
|
|
verify_password takes in a password and the hashed password, and then does magic encryption
|
2019-07-23 14:17:55 +00:00
|
|
|
stuff(no, not really. It basically hashes the password with the same salt and other parameters, but
|
|
|
|
that's not that important to know) and to see if the password stored and the given password match.
|
|
|
|
call these whenever you are working with passwords.
|
|
|
|
so to check if passwords match, use something like verifypassword(customer.password,
|
|
|
|
someplainpassword) see libsodium documentation for more info
|
2019-07-02 18:40:37 +00:00
|
|
|
*/
|
2019-06-30 17:49:20 +00:00
|
|
|
|
|
|
|
string hash_password(string password);
|
|
|
|
bool verify_password(string hashed_password, string unhashed_password);
|
|
|
|
|
|
|
|
#endif
|