Skip to content

Commit 72ff501

Browse files
committed
Password Generator
1 parent 0d11a00 commit 72ff501

File tree

10 files changed

+59
-14
lines changed

10 files changed

+59
-14
lines changed

.vscode/settings.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"python.unitTest.unittestArgs": [
3+
"-v",
4+
"-s",
5+
"./tests",
6+
"-p",
7+
"*_test.py"
8+
],
9+
"python.unitTest.unittestEnabled": true,
10+
"python.linting.enabled": false
11+
}

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ If you have any questions, you can contact me by email morasiu2@gmail.com
1515
1. [07 Project Euler (first 10 problems)](#07)
1616
1. [08 Hangman (with online words)](#08)
1717
1. [09 Love Calculator](#09)
18+
1. [10 Random Sentence Generator](#10)
1819
-----
1920
## Bonus
2021
1. [Loading animation](#bonus1)
2122

2223
## Progress
2324
All - **100** <br>
24-
Done - **10** <br>
25-
Remain - **90** <br>
25+
Done - **12** <br>
26+
Remain - **88** <br>
2627

2728
* <a name="00">00</a> Name Generator - 29.01.2018 *Done* (`Python 3`) <br>
2829
![00](docs/images/00.png)
@@ -50,5 +51,9 @@ Definitions are form [FreeDictionary](https://www.thefreedictionary.com/) </br>
5051
* <a name="09">09</a> Love Calculator - 27.02.2018 *Done* (`C#`)<br>
5152
[How it works](docs/LoveCalculator.md)<br>
5253
![09](docs/images/09.png)
54+
* <a name="10">10</a> Random Sentence Generator - 28.02.2018 *Done* (`C#`) <br>
55+
![10](docs/images/10.png)
56+
* <a name="11">11</a> Password Generator - 28.02.2018 *Done* (`C#`) <br>
57+
![11](docs/images/11.png)
5358
## Bonus
5459
* <a name="bonus1">Bonus 1</a> Loading animation in console 24.02.2018 *Done* (`C#`)![Bonus 1](docs/images/bonus1.gif)

challenges/01_Higher_Lower/HigherLower.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
using System;
22

33
class HigherLower{
4-
static void Main(string[] arg){
4+
static void Main(string[] args){
55
Console.ForegroundColor = ConsoleColor.Green;
66
Console.WriteLine("<----------Higher/Lower Game---------->");
77
Console.WriteLine("Created by Morasiu (morasiu2@gmail.com)");
88
Console.Write("Press any key to start.");
99
Console.ReadKey();
10-
1110
StartGame();
1211
}
1312

0 Bytes
Binary file not shown.

challenges/10_Sentence_Generator/SentenceGenerator.cs

+8-10
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,19 @@ static void Main(string[] args){
99
Console.WriteLine("Created by Morasiu (morasiu2@gmail.com)");
1010
Console.WriteLine("Press any key");
1111
Console.ReadKey();
12-
Console.WriteLine(GetWord("nouns"));
12+
Console.WriteLine(GetSentence());
1313
Console.ReadKey();
1414
}
1515

1616
static string GetSentence(){
17-
string sentence = "The ";
18-
return sentence;
19-
}
20-
21-
static string GetWord(string type){
22-
string word = "";
23-
string url = "https://randomwordgenerator.com/noun.php";
17+
//I know, it take "the easy way" just getting sentence from site, but I couln't find any good sites with nouns, verbs etc.
18+
string sentence = "";
19+
string url = "https://funnysentences.com/random-sentences";
2420
WebClient client = new WebClient();
25-
word = client.DownloadString(url);
26-
return word;
21+
sentence = client.DownloadString(url).Split('\n')[118];
22+
sentence = sentence.Substring(sentence.IndexOf("\"></div>") + 8);
23+
sentence = sentence.Substring(0, sentence.IndexOf("<div class"));
24+
return sentence;
2725
}
2826
}
2927

Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
3+
class PasswordGen{
4+
static void Main(string[] args){
5+
Console.ForegroundColor = ConsoleColor.Green;
6+
Console.WriteLine("<----------Password Generator---------->");
7+
Console.WriteLine("Created by Morasiu (morasiu2@gmail.com)");
8+
Console.ReadKey();
9+
Console.WriteLine("Your password:\n" + Generate());
10+
}
11+
12+
static string Generate(){
13+
// A strong password has:
14+
// - at least 15 characters
15+
// - uppercase letters
16+
// - lowercase letters
17+
// - numbers
18+
// - symbols
19+
int length = 15;
20+
string passwd = "";
21+
string lowLetters = "qwertyuiopasdfghjklzxcvbnm";
22+
string upLetters = lowLetters.ToUpper();
23+
string symbols = "[]{}();:!@#$%^&*?=-_+`~";
24+
string numbers = "0123456789";
25+
string all = lowLetters + upLetters + numbers + symbols;
26+
Random rand = new Random();
27+
for(int i = 0; i < length; i++){
28+
passwd += all[rand.Next(0, all.Length)];
29+
}
30+
return passwd;
31+
}
32+
}
Binary file not shown.

docs/images/10.png

6.09 KB
Loading

docs/images/11.png

5.98 KB
Loading

0 commit comments

Comments
 (0)