Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 24 Mar 2011 18:01:59 +0100
From: Ɓukasz Odzioba <lukas.odzioba@...il.com>
To: john-dev@...ts.openwall.com
Subject: pow64of32

Hi,
i was looking into the JtR sources and found that powering function
implementation is not optimal. It is O(n), but we can do that in
logarithmic time.
It's not a big deal but mayby code listed below, would be better (for
the peace of mind).

void pow64of32(int64 *dst,unsigned int x,int n)
{//O(logn)
  int64 tmp={0,1};
  while(n--){
    if(n%2)
      mul64by32(&tmp,x);
    x*=x;
    n/=2;
  }
}

pow64of32 function is defined in math.c .

Lukas

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ