I have put much thought into this very simple algorithm and I have no clue if it was thought before... But I think it should have.
I also know nothing about other encryption algorithms so I can't tell whether this was already invented or not.
It is all sketched on this paper:
And this is a little C# function for this algorithm.
public static void Encrypt(Stream source, Stream target, byte[] key)
{
int current;
long pos = 0;
int res;
if (source.CanSeek) source.Seek(0, SeekOrigin.Begin);
if (target.CanSeek) target.Seek(0, SeekOrigin.Begin);
while ((current = source.ReadByte()) != -1)
{
byte b = (byte)current;
res = b + key[pos++ % key.Length];
if (res > byte.MaxValue) res -= byte.MaxValue;
target.WriteByte((byte)res);
}
}
All I know about encryption is that it (i-)reversibly changes data to protect it.
From all I know, there is no way to crack the key without knowing the original data.
And to check whether the key is right (in an attempt to decrypt), the data's integrity must be checked. Thus a hash must be known...
So will this almost retarded algorithm keep my data secure?
If not, why?
Edit: Please attempt to crack this!
The encrypted bytes are 169 131 181 215 152 43 55 126 235 88 46 150 17 45 185 122 180 203 34 67 109 54 127 234 87 45 57 222 125 152 142 133
...
The MD5 hash is 116 249 25 168 168 255 211 143 122 60 216 192 37 167 178 112
!
Go ahead!