Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Code C sharp

Featured Replies

Posted

Hello.I am trying to crack basic crackmes for .NET written on C# that can't undestand code.


Please,explain me some ones. Here is function of button clicking..



private void button1_Click(object sender, EventArgs e)
{
string str = "486752416871754464";
string str2 = "";
while (str.Length > 0)
{
str2 = str2 + Convert.ToChar(Convert.ToUInt32(str.Substring(0, 2), 0x10)).ToString();
str = str.Substring(2, str.Length - 2);
}

What the data it converts in the body of cicle while on str2?


 


 


What is str.substring with agruments(0,2) and 0x10.ToString();?


Could someone explain this code better please?I am just newbie in classes and methods of C#


Substring is used to remove bits of a string and return that chunk. So in the case of:


str.Substring(0, 2) this means to start at index 0 of str, and take the next two characters and return them as a new string.


 


So in your case, the first time this is called it would be:


"486752416871754464".Substring(0, 2);


 


That would return a string of:


"48"


 


As for:


Convert.ToChar(Convert.ToUInt32(str.Substring(0, 2), 0x10)).ToString();


 


You need to work from the inside out. The first to happen is:


str.Substring(0, 2) which I explained above.


 


Next is:


 


Convert.ToUInt32(str.Substring(0, 2), 0x10)


 


This will convert the number returned from the Substring to a unsigned integer, using base 16 (0x10 is hex for 16).


 


Last is:


Convert.ToChar( .. ).ToString()


 


Which means to convert the number result to a char which is a single letter in C#, then convert that char to a string.


  • Author

atom0s,great thanks for fast posting.I undestood your lesson

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.