XOR encryption - decrypting it [closed] - c#

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I want to decrypt a string (HWID) which is being sent to my filter as weird characters.
It was working fine until someone released the bypass for it.
So basically I want to decrypt it and check if it's real or fake.
How I'm getting the string (HWID)?
this.hwid = current.ReadAscii(); //reading the packet
I wanna decrypt it (XOR), this is how the string (HWID) looks like; "y'2&dxw|rrbrne{"df!4* |/qd|'`-r5s "
Ignore the quotes
Any help would be appreciated;
How did I get this idea? A friend of mine who actually made the DLL which sends the string (HWID) gave me a hint. But I don't even know what's XOR. And Please if you don't understand what I mean just comment what u don't understand.

x-or is a boolean mathematical operation. You can learn all about it over here https://en.wikipedia.org/wiki/Exclusive_or
To decrypt using x-or in C# you need to use the XOR operator like this c = a ^ b;
To decrypt your string you need the key (something to x-or it with) and then perform the x-or one character at a time. This will be something like converting the strong to a bytearray and then processing one character at a time.
That would be like this question XOR function for two Hex byte arrays

Related

Generate skipable list based on chars [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I am very sure that there is a technical term for this problem, but unfortunately I do not know it.
I have an alphabetical charset and the requirement is to create the combination of all the chars with a maximum length
The idea is (sample):
Generate a collection of A, AA, AAA, AAAA, AAAAA, AAAAAA
Next: A, AB, ABA, ABAA, ABAAA
Next A, AB, ABB, ABBA, ABBAA
The reason:
We have to query an API that delivers search results.
But if I don't get search hits from the API on AAA, I don't need to search for AAAA anymore, because it can't get search hits either. I can then move on to AAB.
The question:
My problem is that I'm not sure how the code has to be built to achieve this goal. I lack the structural approach.
I've already tried nested loops, but unfortunately I don't get the result.
I also used Combination Libraries, but they focus on other problems.
Many thanks for hints!
What you're looking for is a particular data structure called a Tree, but probably more specifically in your case, a Trie.
Trie data structures are commonly used in things like Autocomplete. With the image below, if someone typed "te", I can traverse the Trie and see what options would come after that (tea, ted, ten).
It looks like this would also fit your use case from what I can tell.

Equivalent of assigning char on c++ to c# [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
Does anyone know how to implement the following c++ code in c#
c++
char t = '\0';
t += (char)3;
the output of t would be equal to '\x3'
if I implement the same code in c#
char t = '\0';
t += (char)3;
the output would be different t = '\u0003'
How could I get the same result in c#??
thanks
In both languages the escape sequence \xnn represents a character with the specified byte value nn in hexadecimal.
In both languages the escape sequence \unnnn represents the unicode code point nnnn.
It so happens that the byte value 3 corresponds to the unicode code point U+0003 in the encoding used by C#. This is why the output in C# is \u0003.
The code in both languages does roughly the same thing and both ts will store a value of 3 after both code run. The difference is in the format of the output. I don't know how you get \u0003 as output in C#. Console.WriteLine will print the character out, not its unicode code point.
You can't really get the same output in C# because C# chars are represented differently than those in C++. C++ chars are usually 1 byte, while C# chars are as big as a ushort.

Generating folders using textboxes [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Hello experts, I have to generate series of folders from a TextBox into specified location.I am having two textboxes to specify the limit of folders(say 30 folders).The problem am facing is that the folder names that i will be providing are alpha-numeric(say 121cs3h101) .
How to set limit when i provide an alpha-numeric values?
(For example: i provide textbox1=12cs3h101 and textbox2=12cs3h131 , i need the series limit to be generated). I am working with visual studio 2013 in c# windows form application. Thanks in advance.
ok I will try to give you a lead.
To parse a string or find specific characters one can use RegEx.Match or a simler method called String.Split. In both cases you have to be aware how your string is structured and how it can vary. The limits of variation are very important.
If as you say the beginning is always"12cs3h" you can either split the string at the character 'h'.
string[] sa = s.Split('h');
Or you can even use the index of 'h' (since the length seems to be fixed) and take the rest of the string to get the numbers.
int index = s.IndexOf('h');
The rest is up to you, ... convert, enumerate and so on.
EDIT: There is a nice method that does the enumeration job for you: Enumerable.Range Good luck

SQL CommandText Confusion with double quotes and single quotes [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I am working on making a login system for my website. I am trying to make this code work.
cmd.CommandText="SELECT Usernames,Passwords FROM logininfo WHERE Usernames="" + UsernameInput.Text
+ "AND Passwords="" + PasswordInput.Text + '"";
My only problem is I am confused where to put the " and the ' types of quotes. So this is the code that I am having trouble with. I know it is correct but the single and double quote placement is confusing me and is not letting me compile.
Please don't concatenate SQL, that exposes you to SQL injection.
Use parameters instead.
cmd.CommandText="SELECT Usernames,Passwords FROM logininfo WHERE Usernames=#username AND Passwords=#password";
cmd.Parameters.AddWithValue("#username", UsernameInput.Text);
cmd.Parameters.AddWithValue("#password", PasswordInput.Text);
Also take the advice in the comment of Scott Chamberlain, it is a bad thing to store passwords in clear or encrypted on a database. Just store hashes. But read about how to do it, it's not immediate (you need to salt it correctly and use a robust hashing algorithm such as SHA512).
It's far too complex to explain here but you'll find tons of guides on this problem.

Windows Phone - Decode ASCII in string [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have ASCII encoding characters in string. Something like this:
%7B%22video%22%3A%7B%22JSONinfo%22%3A%7B%22id%22%3A212096%2C%22title
How can I decode it to "normal" string? I've tried to find an answer but I find solutions for byte[] of ASCII characters and so. I have an idea that I can replace all characters that starts with % by character which they represents but I think there is better aproach. And one more thing, solution must works for windows phone. Thanks
Use HttpUtility.UrlDecode().
For example, for the string you have given, the result is "{"video":{"JSONinfo":{"id":212096,"title"
You have may alternatives. Choose whichever works for WP
string s = "%7B%22video%22%3A%7B%22JSONinfo%22%3A%7B%22id%22%3A212096%2C%22title";
var s1 = System.Web.HttpUtility.UrlDecode(s);
var s2 = System.Net.WebUtility.UrlDecode(s);
var s3 = System.Uri.UnescapeDataString(s);

Categories

Resources