C
C#10mo ago
INEEDABGs

I need help with fourms

I made a project to do a password checker and generator. i done most of it. But i am struggling how to make the password checker check if it uses the qwerty format. and to make a score by it.
No description
43 Replies
this_is_pain
this_is_pain10mo ago
what would be the problem qwerty is literally qwertyuiop asdfghjkl zxcvbnm so you have to compare that with the password
Pobiega
Pobiega10mo ago
my approach would be to use a sliding window over the password, length 3, then for each window, check if the window exists in either of the three qwerty-strings
INEEDABGs
INEEDABGsOP10mo ago
I dont understand how to check if it contains that or not
Pobiega
Pobiega10mo ago
check my message just above yours
INEEDABGs
INEEDABGsOP10mo ago
how do i do that
Pobiega
Pobiega10mo ago
Do you know what a sliding window is?
INEEDABGs
INEEDABGsOP10mo ago
no all of this is confusing me too much. I am new to fourms i watched a tutorial video. its not helping that much i cant lie.
Pobiega
Pobiega10mo ago
This has nothing to do with forms
INEEDABGs
INEEDABGsOP10mo ago
Oh i need this in fourms. I did it in console first.
Pobiega
Pobiega10mo ago
Sure, but as said, it's not relevant
INEEDABGs
INEEDABGsOP10mo ago
but i didnt know i had to fo it in forms Ok @Pobiega what is sliding window never heard of it
Pobiega
Pobiega10mo ago
A sliding window in coding is a restricted view of a larger something Let's say the password is abcde We want to look if ABC, BCD or CDE is in your "bad" sequences It's a "window" of length 3 that "slides" over the total
INEEDABGs
INEEDABGsOP10mo ago
oh will it check for both capital and normal letters or do i have to do it differently for both.
Pobiega
Pobiega10mo ago
It won't do anything, it's something you will have to code. But you can easily normalize it so it's case insensitive
INEEDABGs
INEEDABGsOP10mo ago
I dont understand how it helps tho. or how i code it
Pobiega
Pobiega10mo ago
Well you need to know if there are any sequence of three characters in the password that is directly from the qwerty layout Can you really not see how a sliding window would help with that?
INEEDABGs
INEEDABGsOP10mo ago
no I am still clueless.
Pobiega
Pobiega10mo ago
Well, it's unfortunate you didn't answer earlier, cause I'm just about to head to bed
INEEDABGs
INEEDABGsOP10mo ago
Could you help me tmr?
Pobiega
Pobiega10mo ago
But try to think of a way to do this by hand
INEEDABGs
INEEDABGsOP10mo ago
perhaps
Pobiega
Pobiega10mo ago
Maybe?
INEEDABGs
INEEDABGsOP10mo ago
ok sleep well
Pobiega
Pobiega10mo ago
Step one is to figure out the problem. Step two is to come up with a solution. Step three is translating that solution into code.
INEEDABGs
INEEDABGsOP10mo ago
Ok
Pobiega
Pobiega10mo ago
No description
Pobiega
Pobiega10mo ago
This is a "sliding window" over a string. The window length is 3. so for this string, we'd get 3 results back. for each of these results, we test if that 3-length string exists in any of the known qwerty strings you'd then do something like...
var password = "hellofghjhello"; // get this from the form

foreach (var window in password.Window(3)) // Window is a custom extension method
{
if (IsSequenceFromQwerty(window))
{
// You would probably just increment a count here and return the count, or do the score caluclations directly
Console.WriteLine($"Found sequence: {window}");
}
}

// this is the signature of the extension method
static IEnumerable<string> Window(this string source, int size)
var password = "hellofghjhello"; // get this from the form

foreach (var window in password.Window(3)) // Window is a custom extension method
{
if (IsSequenceFromQwerty(window))
{
// You would probably just increment a count here and return the count, or do the score caluclations directly
Console.WriteLine($"Found sequence: {window}");
}
}

// this is the signature of the extension method
static IEnumerable<string> Window(this string source, int size)
how to implement the Window and IsSequenceFromQwerty methods is up to you.
INEEDABGs
INEEDABGsOP10mo ago
Oh
Pobiega
Pobiega10mo ago
do you get the idea?
INEEDABGs
INEEDABGsOP10mo ago
kind of So i use the sliding window to make sure if there is qwerty or not. but in order to use it i have to download it. right from extensions
Pobiega
Pobiega10mo ago
.. download it? what no you write it
INEEDABGs
INEEDABGsOP10mo ago
oh
Pobiega
Pobiega10mo ago
its just a simple method.
INEEDABGs
INEEDABGsOP10mo ago
ok
Pobiega
Pobiega10mo ago
also, eh.. you use it as part of your solution, specifically the "any sequence of length 3" part
INEEDABGs
INEEDABGsOP10mo ago
oh ok
Pobiega
Pobiega10mo ago
the sliding window itself doesnt know or care about qwerty
INEEDABGs
INEEDABGsOP10mo ago
So i have to add the qwerty part.
Pobiega
Pobiega10mo ago
Did you read the snippet I sent? and the messages around it? ...
MODiX
MODiX10mo ago
Pobiega
how to implement the Window and IsSequenceFromQwerty methods is up to you.
Quoted by
<@105026391237480448> from #I need help with fourms (click here)
React with ❌ to remove this embed.
INEEDABGs
INEEDABGsOP10mo ago
yea
Pobiega
Pobiega10mo ago
You have to implement the two methods that don't exist in that snippet of code Window might be a little tricky, but it's also a fairly common thing so should be googlable The qwerty one should be pretty easy
INEEDABGs
INEEDABGsOP10mo ago
aight i do that

Did you find this page helpful?