12,076,206 members (48,182 online)
See more:
Hi,
First, I know that .NET libraries defines AES encryption but I can't use them. It is a school project.
I was trying to write some algorithm for operation polynom modulo. I have written one, but it has been too slow, can somebody help me?

How does it work?
Look: The input for this operation are two byte numbers. Each byte number consists of 8 bits. The idea of creating a polynom is, that every bit in it's order we multiply by x powered by the order:

For example: we have numbers that fits in the byte - for example 255 (11111111 in binary format) and 71 (01000111 in binary format).
The polynom for 11111111 is: 1*x^7 + 1*x^6 + 1*x^5 + 1*x^4 + 1*x^3 + 1*x^2 + 1*x^0 + 1*x^0.
The polynom for 01000111 is: 0*x^7 + 1*x^6 + 0*x^5 + 0*x^4 + 0*x^3 + 1*x^2 + 1*x^0 + 1*x^0.

We have to do the modulo operation with these polynoms (forget about it, that Galois field has not declared division). So we have to divide a polynom by a polynom.

Here is a quite fast code how to convert a byte to bits:
```byte number = 255;
byte numeralSystem = 2;
string bits =  Convert.ToString(number, numeralSystem);
//completion of zeroes
while (bits.Length < 8)
{
bits = "0" + bits;
}
```

Imagine, that you have implemented a method Polynom polynomModulo(Polynom pol1, Polynom pol2) that returns the rest after division of po1/pol2 and uses these methods:
```Member divide(Member x, Member y); //Type Member is one member from a polynom (example: 1*x^5). This method gets in the parameter x the actual member with the highest power (in the first iteration it is the member of the dividend with the highest power, otherwise it is the member with the hignest power of the actual rest of division) and also it gets in the parameter y the member with the highest power of the divisor. Method divides x by y and returns the result.
Polynom multiply(Polynom divisor, Member result) //This method is used for multiplication of the divisor by the actual result, method returns value, that is used for subtract.
Polynom subtract(Polynom rest, Polynom newRest)//This subtracts the newRest from the rest, the newRest is the result of the multiply method.```

Please write here some fast algorithm for these methods and implement assistant objects for it.
Or implement polynom modulo completly by your own algorithm.

Thanks a lot!

Pepin z Hané
Closed because the post is not clear, or is incomplete and has not been phrased in a way that allows it to be fully understood.. Reported by RyanDev on Saturday, July 27, 2013 3:04pm
Posted 20-Apr-13 12:01pm
Edited 20-Apr-13 12:58pm
v2

Top Experts
Last 24hrsThis month
 Richard MacCutchan 414 Jochen Arndt 345 OriginalGriff 332 Sergey Alexandrovich Kryukov 280 F-ES Sitecore 225
 Dave Kreskowiak 2,836 OriginalGriff 2,805 Richard MacCutchan 2,174 CPallini 1,607 CHill60 1,379