ajron

September 11th, 2002, 00:51

Hi!

I have a problem with some algo. I included its pseudo code below. It's something like PowerMod but not exactly. It's used in public key cryptography. Does anyone know what's this? The algorithm operate on m,e,n and e is like in RSA e=65537. I do calculation for a few first e.

e=1: [m] mod n

e=2: [m^2-2] mod n

e=3: [m^3-3m] mod n

e=4: [m^4-4m^2+2] mod n

e=5: [m^5-5m^3-5m] mod n

e=6: [m^6-6m^4+9m^2-2] mod n

e=7: [m^7-7m^5+14m^3-7m] mod n

This is an algorithm:

In: M,N,E

R=M mod N

A=2

B=R

for(bit=BitCount(E)-1; bit>=0; bit--)

{

if(BitSet(E,bit)) // if bit=1

{

A=[(N-R)+(A*B)] mod N

B=[(N-2)+B^2] mod N

}

else // if bit=0

{

B=[(N-R)+(A*B)] mod N

A=[(N-2)+A^2] mod N

}

}

Out=A

Best regards,

Ajron.

ps. sorry for my english

I have a problem with some algo. I included its pseudo code below. It's something like PowerMod but not exactly. It's used in public key cryptography. Does anyone know what's this? The algorithm operate on m,e,n and e is like in RSA e=65537. I do calculation for a few first e.

e=1: [m] mod n

e=2: [m^2-2] mod n

e=3: [m^3-3m] mod n

e=4: [m^4-4m^2+2] mod n

e=5: [m^5-5m^3-5m] mod n

e=6: [m^6-6m^4+9m^2-2] mod n

e=7: [m^7-7m^5+14m^3-7m] mod n

This is an algorithm:

In: M,N,E

R=M mod N

A=2

B=R

for(bit=BitCount(E)-1; bit>=0; bit--)

{

if(BitSet(E,bit)) // if bit=1

{

A=[(N-R)+(A*B)] mod N

B=[(N-2)+B^2] mod N

}

else // if bit=0

{

B=[(N-R)+(A*B)] mod N

A=[(N-2)+A^2] mod N

}

}

Out=A

Best regards,

Ajron.

ps. sorry for my english