Register for your free account! | Forgot your password?

You last visited: Today at 00:14

  • Please register to post and access all features, it's quick, easy and FREE!


[C#]ASCIIM

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 369
[C#]ASCIIM

This is the class.
Code:
public class ASCIIM
    {
        public byte[] Bytes;
        public byte[] Keys;
        public int KeyLength
        {
            get { return Keys.Length - 2; }
        }

        public void GetBytes(string String)
        {
            byte[] bytes = new byte[String.Length];
            bytes = Encoding.ASCII.GetBytes(String);

            for (int i = 0; i < bytes.Length; i++)
            {
                for (int u = 0; u < Keys.Length; u++)
                {
                    if (u < KeyLength)
                    {
                        int key = (int)Keys[u] ^ (int)Keys[u + 1] + ((int)Keys[u + 1] ^ (int)Keys[u]);
                        bytes[i] += (byte)key;
                    }
                    else
                        u = Keys.Length + 1;
                }
            }

            Bytes = bytes;
        }
        public string Decode()
        {
            byte[] bytes = Bytes;
            for (int i = 0; i < Bytes.Length; i++)
            {
                for (int u = 0; u < Keys.Length; u++)
                {
                    if (u < KeyLength)
                    {
                        int key = (int)Keys[u] ^ (int)Keys[u + 1] + ((int)Keys[u + 1] ^ (int)Keys[u]);
                        bytes[i] -= (byte)key;
                    }
                    else
                        u = Keys.Length + 1;
                }
            }

            return Encoding.ASCII.GetString(Bytes);
        }
        public string GetString()
        {
            string retstring = "";
            for (int i = 0; i < Bytes.Length; i++)
            {
                retstring += Bytes[i] + " ";
            }

            return retstring;
        }
    }
All it does is changing the bytes. If the keys are invalid or not entered at decoding, then you will get a wrong value back. It can be very useful. I was just playing around with it for fun and thought I would try see if it works and it did. It took maybe 5-10minutes.

Example:
Code:
ASCIIM ascii = new ASCIIM();
            ascii.Keys = new byte[]
            {
                1, 2, 1, 2, 1, 2
            };
            ascii.GetBytes("Hello World!");
            Console.WriteLine(ascii.GetString());//Writing our bytes.
Console.WriteLine(Encoding.ASCII.GetString(ascii.Bytes));//Writing decoding bytes without keys.
            Console.WriteLine(ascii.Decode());//Decoding and writing the decoded bytes.
Output:
Code:
92 121 128 128 131 52 107 131 134 128 20 53
\y???4k???x5
Hello World!
Oh and I'm unbanned



Syst3m_W1z4rd is offline  
Thanks
1 User
Old 05/01/2011, 23:57   #2
 
elite*gold: 223
Join Date: Dec 2007
Posts: 1,045
Received Thanks: 218
This actually comes in handy you know? I want to make a name spoofed in my proxy, but i didn't know how to convert an string to byte[]. Thank you


OELABOELA is offline  
Old 05/02/2011, 00:26   #3
 
elite*gold: 0
Join Date: Jul 2006
Posts: 1,933
Received Thanks: 664
@OELABOELA:

No offense but you could always do
for(i=0; i<strlen(myString); ++i) { myArray[i]=(BYTE)myString[i]; }
KraHen is offline  
Old 05/02/2011, 00:33   #4
 
elite*gold: 0
Join Date: May 2008
Posts: 248
Received Thanks: 279
Quote:
Originally Posted by KraHen View Post
@OELABOELA:

No offense but you could always do
for(i=0; i<strlen(myString); ++i) { myArray[i]=(BYTE)myString[i]; }
Code:
Encoding.ASCII.GetBytes(str());


w00tare is offline  
Old 05/02/2011, 14:54   #5
 
elite*gold: 0
Join Date: Jul 2006
Posts: 1,933
Received Thanks: 664
Which does the same thing afaik.
KraHen is offline  
Old 05/02/2011, 16:33   #6
 
elite*gold: 0
Join Date: May 2008
Posts: 248
Received Thanks: 279
Quote:
Originally Posted by KraHen View Post
Which does the same thing afaik.
But its faster
w00tare is offline  
Old 05/02/2011, 22:39   #7
 
elite*gold: 0
Join Date: Jul 2006
Posts: 1,933
Received Thanks: 664
Quote:
Originally Posted by w00tare View Post
But its faster
Why would it be faster?
KraHen is offline  
Thanks
1 User
Old 05/02/2011, 22:52   #8
 
elite*gold: 0
Join Date: Nov 2010
Posts: 237
Received Thanks: 99
Quote:
Originally Posted by w00tare View Post
But its faster
Bullshit
|NeoX is offline  
Old 05/02/2011, 23:14   #9
 
elite*gold: 0
Join Date: May 2008
Posts: 248
Received Thanks: 279
Quote:
Originally Posted by |NeoX View Post
Bullshit
I meant faster to typ. >.>
w00tare is offline  
Old 05/03/2011, 15:07   #10
 
elite*gold: 20
Join Date: Mar 2006
Posts: 6,124
Received Thanks: 2,503
Encoding.ASCII.GetBytes();

This is marginally slower (you wouldnt even notice) than the other method, but its safer. So you should be using this method, the method in the original post is going to be much slower for seemingly little gain of anything.....
Korvacs is offline  
Old 05/03/2011, 22:17   #11
 
elite*gold: 0
Join Date: Nov 2010
Posts: 1,162
Received Thanks: 369
Well the one in OP is not efficient really, but I improved it and made something else from it, but that's most likely why I was about to share it. Peoples can either improve it or don't


Syst3m_W1z4rd is offline  
Reply



« More unknown packet types... | Refreshing the screen »



All times are GMT +1. The time now is 00:14.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.