forked from rtrettin/cop4530
-
Notifications
You must be signed in to change notification settings - Fork 0
/
passserver.h
40 lines (36 loc) · 956 Bytes
/
passserver.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* Remi Trettin COP4530 Assignment 5 */
#ifndef PASSSERVER_H
#define PASSSERVER_H
#include <iostream>
#include <fstream>
#include <sstream>
#include <unistd.h>
#include <crypt.h>
#include <vector>
#include <list>
#include <string>
#include <utility>
#include <cstdlib>
#include <cstring>
#include "hashtable.h"
using namespace std;
using namespace cop4530;
class PassServer {
public:
PassServer(size_t size = 101);
~PassServer();
bool find(const string &k) const;
bool addUser(const pair<string, string> & key_value);
bool addUser(pair<string, string> && key_value);
bool removeUser(const string &k);
bool changePassword(const pair<string, string> &p, const string &newpasswd);
void clear();
bool load(const char *filename);
void dump() const;
bool write_to_file(char *filename);
size_t size() const;
private:
HashTable<string, string> passwords;
string encrypt(const string &str);
};
#endif