This repository has been archived on 2026-07-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
PasswordEncryption/GeneratePasswordFileName.cpp
T
amazing-username cec1e0bbb6 Code cleanup
2018-02-26 22:01:00 -06:00

39 lines
982 B
C++

#include<iostream>
#include<ctime>
#include<cstdlib>
#include"GeneratePasswordFileName.h"
GeneratePasswordFileName::GeneratePasswordFileName()
{
generatedFileName();
}
/*
void GeneratePasswordFileName::setupTime()
{
time_t epochTime = time(0);
tm* currentTime = localtime(&epochTime);
year = 1900 + currentTime->tm_year;
month = 1 + currentTime->tm_mon;
dayOfMonth = currentTime->tm_mday;
}
*/
void GeneratePasswordFileName::generatedFileName()
{
filename.assign(dateString());
for (auto index = 0; index!=8; ++index)
{
if (index==0) filename.append("_");
else
{
auto randomInteger = rand() % 10;
filename.append(std::to_string(randomInteger));
}
}
}
string GeneratePasswordFileName::passwordFileNameString() const { return filename; }
int GeneratePasswordFileName::retrieveYear() const { return year; }
int GeneratePasswordFileName::retrieveMonth() const { return month; }
int GeneratePasswordFileName::retrieveDayOfMonth() const { return dayOfMonth; }