Parkmanne/headers/old/encrypt.h
2019-07-23 12:34:06 -03:00

26 lines
929 B
C++

#ifndef ENCRYPT_H
#define ENCRYPT_H
#pragma once
#include <cstring>
#include <iostream>
#include <sodium.h>
#include <string>
using std::string;
/*
hash_password takes the password, and encrypts it. This needs to be done,
because storing passwords in plaintext is BAD, no matter if it's just for a school project!
verify_password takes in a password and the hashed password, and then does magic encryption
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
*/
string hash_password(string password);
bool verify_password(string hashed_password, string unhashed_password);
#endif