This project is read-only.

Great idea for encryption

Topics: Off Topic, Using Cosmos (Developing your own OS, projects, etc)
Oct 25, 2012 at 4:52 AM

I had a great idea for encryption. This is the basic idea:

public byte[] encrypt(byte[] data, int seed)
{
List<byte> rtrn = new List<byte>();
Random r = new Random(seed);
foreach(byte b in data)
{
Int16 data = r.Next(0,255)+b;
rtrn.Add(data.ToByteArray());//just an example
}
return rtrn.ToArray();
}
And because randoms always give the same value with the same seed, this could decrypt too.

Oct 26, 2012 at 11:02 AM

Its not really encryption, but minor obfuscation. But really we need to focus on basics right now like multi dimension arrays, memory manager, etc.

Oct 26, 2012 at 8:46 PM
jpal wrote:

I had a great idea for encryption. This is the basic idea:

 

public byte[] encrypt(byte[] data, int seed)
{
List<byte> rtrn = new List<byte>();
Random r = new Random(seed);
foreach(byte b in data)
{
Int16 data = r.Next(0,255)+b;
rtrn.Add(data.ToByteArray());//just an example
}
return rtrn.ToArray();
}
And because randoms always give the same value with the same seed, this could decrypt too.

 

Dude modern encryption algorithms are WAY MORE COMPIICATED THAN THAT! This may help you come up with a good algorithm 

https://opensource.conformal.com/viewgit/?a=viewblob&p=cyphertite&h=899259f8ba145c11087088ec83153db524031800&hb=6782c6839d847fbed0aed8c55917e78b5684110f&f=cyphertite/ct_crypto.c 

Oct 26, 2012 at 10:40 PM

I meant basic encryption(Like for a filesystem).

Oct 26, 2012 at 11:34 PM

my c# knowledge is limited but from what I gather your just offsetting the data a little, a technique easily deciphered in the roman times. Hardly encryption.

Oct 27, 2012 at 12:33 AM
jpal wrote:

I meant basic encryption(Like for a filesystem).

still that is very inadequate. An effective algorithm would generate completely different values for similar strings.

 

For example lets say you had Hello1 and Hello2, a good algoritm would generate something like dsfsfhgbfdf and 34rdefsazfr3q now thats just random jiberish but as you can see they do not resemble each other at all. 

Oct 27, 2012 at 12:46 PM

There are plenty of encryption algorithms out there with source in several languages, I don't see why if you want to use encryption, you don't just find one (say the SHA-512 hashing algorithm) and port it. 

Oct 27, 2012 at 1:13 PM

Something about an AES implementation in pure C# there. Certainly one of the hardest to crack (of course everything with encrypt/decrypt functionality [so not hashing] is crackable given enough time and a good algorithm). There are others this is just the first that came to mind.

http://stackoverflow.com/questions/165808/simple-2-way-encryption-for-c-sharp

 

I believe hashes are designed to specifically not be decryptable even with the original key. Instead they are more useful for storing data such as passwords. When the user creates their password you would store its hash in the database, you could safely use the same key for all passwords, shouldn't even matter too much if the key is leaked. Then whenever the user enters their password to log in to something you would take its hash again (using the same key) and compare the hashes. Even with the key you shouldn't be able to go from hash back to password easily (hence why websites send you an entirely new password if you forget it usually). Some hashing algorithms are ultimately crackable still but they are designed not to be.

Oct 27, 2012 at 9:16 PM

This is designed to encrypt a users files in Quicksilver OS. Other users can't access them without the password.

Oct 28, 2012 at 1:12 AM
jpal wrote:

This is designed to encrypt a users files in Quicksilver OS. Other users can't access them without the password.

One I see no filesystem in QuickSilver and two I could write a program to crack this very easily.

Oct 28, 2012 at 1:17 AM

Best port am existing algo.

Oct 28, 2012 at 1:43 AM

Try. I will give you the new source code for encrypt:

   public static byte[] encrypt(byte[] input, int seed)

        {

            Random r = new Random(seed);

            byte[] buffer = new byte[input.Length];

            List<byte> rtrn = new List<byte>();

            r.NextBytes(buffer);

            int i = 0;

            foreach (byte b in input)

            {

                Int16 tmp = (Int16)(b * buffer[i]);

                byte[] temp = ini16(tmp);

                rtrn.Add(temp[0]);

                rtrn.Add(temp[1]);

                i++;

            }

            return rtrn.ToArray();

        }

Decode this byte array: 38,54,24,0,79,67,105,147,95,223,17,248,2,63,5,224,80,211,50,76,92,82,1,64,87,219,2,94,49,224,59,147,31,128,13,206,49,161,39,110,76,200,37,40

Oct 28, 2012 at 1:45 AM

I am working on adding a file system to Quicksilver OS 2013. After CosmosHD.

Oct 28, 2012 at 1:51 AM

I can't crack it now as I'm installing Windows 8, but it looks only to be somewhat more complex than before. Check the links grunt posted and try researching encryption a bit (I hope I don't sound mean, I'm only trying to help)

On Oct 27, 2012 6:45 PM, "jpal" <notifications@codeplex.com> wrote:

From: jpal

I am working on adding a file system to Quicksilver OS 2013. After CosmosHD.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Oct 28, 2012 at 3:03 AM
jpal wrote:

Try. I will give you the new source code for encrypt:

   public static byte[] encrypt(byte[] input, int seed)

        {

            Random r = new Random(seed);

            byte[] buffer = new byte[input.Length];

            List<byte> rtrn = new List<byte>();

            r.NextBytes(buffer);

            int i = 0;

            foreach (byte b in input)

            {

                Int16 tmp = (Int16)(b * buffer[i]);

                byte[] temp = ini16(tmp);

                rtrn.Add(temp[0]);

                rtrn.Add(temp[1]);

                i++;

            }

            return rtrn.ToArray();

        }

Decode this byte array: 38,54,24,0,79,67,105,147,95,223,17,248,2,63,5,224,80,211,50,76,92,82,1,64,87,219,2,94,49,224,59,147,31,128,13,206,49,161,39,110,76,200,37,40

Can you give me something a little bit longer than 3 characters? I have several possible answers.

Oct 28, 2012 at 3:23 AM

Oh and by chance is it Lag? (seed 54774)

Oct 28, 2012 at 5:06 AM

It is not Lag. It is over 20 characters.(40 bytes)

Oct 28, 2012 at 5:10 AM

What is ini16? And did you get that from cosmos or windows? (I think cosmos randoms are different from the normal ones on windows)

Oct 28, 2012 at 5:13 AM

ini16(in int16) takes an int16 in and returns two bytes.

Oct 28, 2012 at 5:16 AM

Oh, I got it from .net 4.0 with Windows 8 Enterprise Preview.

Oct 28, 2012 at 5:33 AM

You know, for such a simple encryption method, its taking a long time to crack

Oct 28, 2012 at 5:53 AM
jpal wrote:

You know, for such a simple encryption method, its taking a long time to crack

maybe because I closed my visual studio because I was waiting for you to reply earlier.... And I am at it again, my cracker is running right now :) But just to make sure the random is the same on .net 4.0 can you tell me what hello is with seed 400?

Oct 28, 2012 at 6:09 AM

and is the seed between 0-67448 (just wondering because that is howmany seeds my cracker attempted with no results yet.

Oct 28, 2012 at 1:55 PM

Sorry, I sleep sometimes, and am currently doing so. Therefore I don't get to participate in the cracking arts.

Oct 28, 2012 at 8:19 PM

I just got a new laptop with windows 8 core. Hello in seed 400 is byte array 10,248,19,186,86,232,48,240,83,175. I will give a different array, because the first one had a seed over 100,000. Here is the new array: 53,83,31,128,14,124,77,61,45,95,55,65,92,23,0,0,119,28,13,2,45,63,30,160,72,132,54,114,112,170,8,73,4,128,9,90,41,109,65,149,59,80,25,96

Oct 28, 2012 at 10:14 PM
jpal wrote:

I just got a new laptop with windows 8 core. Hello in seed 400 is byte array 10,248,19,186,86,232,48,240,83,175. I will give a different array, because the first one had a seed over 100,000. Here is the new array: 53,83,31,128,14,124,77,61,45,95,55,65,92,23,0,0,119,28,13,2,45,63,30,160,72,132,54,114,112,170,8,73,4,128,9,90,41,109,65,149,59,80,25,96

Weird I get 104,101,108,108,111 for hello and I am using the code you gave me (just no using ini, instead I am using BitConvertor.Getbytes because I do not have ini)

Oct 29, 2012 at 3:43 AM

ini does this: return new byte[]{input/256,input%256};

Oct 29, 2012 at 6:08 AM
jpal wrote:

ini does this: return new byte[]{input/256,input%256};

Lol ok, just one more thing, can you give me a range (like 0 to 500000) it can be off by a couple thousand but I just want to make sure my cracker isn't decrypting properly (although I did get hello decrypted, finally...

Oct 29, 2012 at 6:08 AM
jpal wrote:

ini does this: return new byte[]{input/256,input%256};

Lol ok, just one more thing, can you give me a range (like 0 to 500000) it can be off by a couple thousand but I just want to make sure my cracker isn't decrypting properly (although I did get hello decrypted, finally...

Oct 29, 2012 at 1:42 PM

0-67488

Oct 31, 2012 at 12:31 AM
jpal wrote:

0-67488

Dude your bullshiting me because I can decrypt everything else, besides that.....


     public static byte[] decrypt(byte[] input, int seed)
        {

            Random r = new Random(seed);

            byte[] buffer = new byte[input.Length];

            List<byte> rtrn = new List<byte>();

            r.NextBytes(buffer);

            int rp = 0;
            for (int i = 0; i < input.Length; i += 2)
            {
                short ch = input[i + 1];
                if (input[i] == 0)
                {

                }
                else
                {
                    ch = (short)(input[i + 1] + (256 * input[i]));
                }
                if (buffer[i / 2] != 0)
                {
                    ch = (byte)(ch / buffer[i / 2]);

                    rtrn.Add((byte)ch);
                }
               rp++;
            }
            rp = 0;
    
            return rtrn.ToArray();

        }
 

Oct 31, 2012 at 12:31 AM
jpal wrote:

0-67488

Dude your bullshiting me because I can decrypt everything else, besides that.....


     public static byte[] decrypt(byte[] input, int seed)
        {

            Random r = new Random(seed);

            byte[] buffer = new byte[input.Length];

            List<byte> rtrn = new List<byte>();

            r.NextBytes(buffer);

            int rp = 0;
            for (int i = 0; i < input.Length; i += 2)
            {
                short ch = input[i + 1];
                if (input[i] == 0)
                {

                }
                else
                {
                    ch = (short)(input[i + 1] + (256 * input[i]));
                }
                if (buffer[i / 2] != 0)
                {
                    ch = (byte)(ch / buffer[i / 2]);

                    rtrn.Add((byte)ch);
                }
               rp++;
            }
            rp = 0;
    
            return rtrn.ToArray();

        }
 

Oct 31, 2012 at 12:31 AM
jpal wrote:

0-67488

Dude your bullshiting me because I can decrypt everything else, besides that.....


     public static byte[] decrypt(byte[] input, int seed)
        {

            Random r = new Random(seed);

            byte[] buffer = new byte[input.Length];

            List<byte> rtrn = new List<byte>();

            r.NextBytes(buffer);

            int rp = 0;
            for (int i = 0; i < input.Length; i += 2)
            {
                short ch = input[i + 1];
                if (input[i] == 0)
                {

                }
                else
                {
                    ch = (short)(input[i + 1] + (256 * input[i]));
                }
                if (buffer[i / 2] != 0)
                {
                    ch = (byte)(ch / buffer[i / 2]);

                    rtrn.Add((byte)ch);
                }
               rp++;
            }
            rp = 0;
    
            return rtrn.ToArray();

        }
 

Nov 2, 2012 at 5:30 PM

Did you use UTF8 encoding? And try to decode this: 61,137,8,61,90,243,25,64,7,112,60,93,57,114,96,169,20,224,108,54,74,166,65,46,30,120,19,240,25,40

Nov 2, 2012 at 9:11 PM
jpal wrote:

Did you use UTF8 encoding? And try to decode this: 61,137,8,61,90,243,25,64,7,112,60,93,57,114,96,169,20,224,108,54,74,166,65,46,30,120,19,240,25,40

wait is that anscii? (I use anscii and that is what cosmos uses....)

Nov 2, 2012 at 9:50 PM

Use Encoding.UTF8.GetBytes()/Encoding.UTF8.GetString(). UTF7 is ascii.