C
C#3mo ago
vibing subs

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
boiled goose
boiled goose3mo ago
what would be the problem qwerty is literally qwertyuiop asdfghjkl zxcvbnm so you have to compare that with the password
Pobiega
Pobiega3mo 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
vibing subs
vibing subs3mo ago
I dont understand how to check if it contains that or not
Pobiega
Pobiega3mo ago
check my message just above yours
vibing subs
vibing subs3mo ago
how do i do that
Pobiega
Pobiega3mo ago
Do you know what a sliding window is?
vibing subs
vibing subs3mo 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
Pobiega3mo ago
This has nothing to do with forms
vibing subs
vibing subs3mo ago
Oh i need this in fourms. I did it in console first.
Pobiega
Pobiega3mo ago
Sure, but as said, it's not relevant
vibing subs
vibing subs3mo ago
but i didnt know i had to fo it in forms Ok @Pobiega what is sliding window never heard of it
Pobiega
Pobiega3mo 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
vibing subs
vibing subs3mo ago
oh will it check for both capital and normal letters or do i have to do it differently for both.
Pobiega
Pobiega3mo 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
vibing subs
vibing subs3mo ago
I dont understand how it helps tho. or how i code it
Pobiega
Pobiega3mo 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?
vibing subs
vibing subs3mo ago
no I am still clueless.
Pobiega
Pobiega3mo ago
Well, it's unfortunate you didn't answer earlier, cause I'm just about to head to bed
vibing subs
vibing subs3mo ago
Could you help me tmr?
Pobiega
Pobiega3mo ago
But try to think of a way to do this by hand
vibing subs
vibing subs3mo ago
perhaps
Pobiega
Pobiega3mo ago
Maybe?
vibing subs
vibing subs3mo ago
ok sleep well
Pobiega
Pobiega3mo 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.
vibing subs
vibing subs3mo ago
Ok
Pobiega
Pobiega3mo ago
No description
Pobiega
Pobiega3mo 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.
vibing subs
vibing subs3mo ago
Oh
Pobiega
Pobiega3mo ago
do you get the idea?
vibing subs
vibing subs3mo 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
Pobiega3mo ago
.. download it? what no you write it
vibing subs
vibing subs3mo ago
oh
Pobiega
Pobiega3mo ago
its just a simple method.
vibing subs
vibing subs3mo ago
ok
Pobiega
Pobiega3mo ago
also, eh.. you use it as part of your solution, specifically the "any sequence of length 3" part
vibing subs
vibing subs3mo ago
oh ok
Pobiega
Pobiega3mo ago
the sliding window itself doesnt know or care about qwerty
vibing subs
vibing subs3mo ago
So i have to add the qwerty part.
Pobiega
Pobiega3mo ago
Did you read the snippet I sent? and the messages around it? ...
MODiX
MODiX3mo 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.
vibing subs
vibing subs3mo ago
yea
Pobiega
Pobiega3mo 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
vibing subs
vibing subs3mo ago
aight i do that