Anonymous
Anonymous asked in Computers & InternetSecurity · 1 decade ago

How secure is this c# encryption algorithm? (if a salt were used)?

byte[] bytes = ASCIIEncoding.ASCII.GetBytes(textBox1.Text);

int hash = 1;

for (int n = 0; n < 10000; n++)

{

for (int i = 0; i < bytes.Length; i++)

{

if ((i * n) % 5 == 0)

{

hash *= bytes[i];

}

if ((i * n) % 5 == 1)

{

hash += bytes[i];

}

if ((i * n) % 5 == 2)

{

hash -= bytes[i];

}

if ((i * n) % 5 == 3)

{

hash += bytes[i];

}

if ((i * n) % 5 == 4)

{

hash *= bytes[i];

}

}

}

return hash

1 Answer

Relevance
  • 1 decade ago
    Best Answer

    This is an empirical question that can be determined via a test that you are asking opinions about.

    First, I'm not sure this is an encryption algorithm rather than a hashing algorithm.

    Secondly, as a hashing algorithm there are 2 properties of interest. 1) whether for a large number of possible inputs, keys are duplicated indicating hash collisions. This is also a good indication of how random the bits are assigned.

    2) whether the algorithm can be reversed. In security a one-way hash algorithm is better because it can't be reversed to find the key.

    Since if any byte is 0 the output of the last pass will be 0, my guess is it isn't a good algorithm for binary data.

Still have questions? Get your answers by asking now.