Re: squaring



On 19 Jul 2005 23:13:54 -0700, asetofsymbols@xxxxxxxxx wrote:
>in the book "Handbook of Applied Cryptography by A. Menezes, P. van
>Oorschot and S. Vanstone" i have find this algorithm
>-------------------------------------------------
>14.16 Algorithm Multiple-precision squaring
>INPUT: positive integer x = ( x_(t-1), x_(t-2), ... ,x1, x0)b.
>OUTPUT: x * x = x^2 in radix b representation.
>1. For i from 0 to (2t - 1) do: w_i=0.
>2. For i from 0 to (t - 1) do the following:
> 2.1 (uv)b=w_(2i) + x_i * x_i, w_(2i)=v, c=u.
> 2.2 For j from (i + 1) to (t - 1) do the following:
> (uv)b=w_(i+j) + 2*x_j * x_i + c, w_(i+j)=v, c=u.
> 2.3 w_(i+t)=u.
>3. Return((w_(2t-1), w_(2t-2), ... w_1, w_0)b).
>
>14.17 Note (computational efficiency of Algorithm 14.16)
>(i) (overflow) In step 2.2, u can be larger than a single-precision
>integer. Since w_(i+j)is always set to v, w_(i+j) <= b - 1.
>If c <= 2(b - 1), then w_(i+j) + 2*x_j*x_i + c =
>(b-1)+2(b-1)^2 +2(b-1) = (b-1)(2b+1), implying 0 <= u <= 2(b-1). This
>value of u may exceed single-precision, and must be accommodated.
>----------------------------------------------

Is it possible that book can have an error in "14.16 Algorithm
Multiple-precision squaring"? ... yes
The error was in the book (and so in my implementation of it)
but i have correct it

>Do you think I have make something illegal in write this in a ng?
>If i implement this algorithm in assembly do you think i have to write
>a copyright note for say where i have find it?
.



Relevant Pages

  • Re: (Oz vs Delphi), Part 2, Pascals Triangle.
    ... >> After that an integer overflow occurs. ... > The algorithm is sound, regardless of how precise you can get. ... > without recursion and without lots of list operations. ... >> So the funny thing is Delphi bites you in the ass sooner than it bites ...
    (alt.comp.lang.borland-delphi)
  • Re: int/long unification hides bugs
    ... > The algorithm uses the fundamental theorem of arithmetic ... > every atom in the molecule, ... > In very rare cases this can overflow 32 bits. ... > Because Python now no longer gives this overflow error, ...
    (comp.lang.python)
  • Re: how to define hashcode for this class?
    ... If someone can show me that overflow in a hasing algorithm is NEVER a problem I will let my overflow worries ebb ... hash *= 2;} ...
    (comp.lang.java.programmer)
  • Re: Could you please help me - branch command
    ... an overflow is generated for unsigned numbers. ... If you are really interested in assembly programing (and not only ... number of branch statements is such and not less and more. ... that CPU has we can create almost any algorithm we want, ...
    (alt.lang.asm)
  • Re: Can a "value" overflow?
    ... You'll probably have to generate a special exception for INT_MIN, ... modify your algorithm. ... The overflow happens to the value itself, so you can't save it by using ...
    (comp.lang.c)