Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Thu, 04 Jul 2013 07:54:35 +0200
From: marcus.desto <marcus.desto@...pl>
To: john-dev@...ts.openwall.com
Subject: Re: OpenCL PBKDFv2 Kernel With Python

Hello Sayantan,
thank you for reply.
Dnia 4 lipca 2013 5:53 Sayantan Datta &lt;std2048@...il.com&gt; napisał(a):
Hi,
On Thu, Jul 4, 2013 at 12:28 AM, marcus.desto &lt;marcus.desto@...pl&gt; wrote:
void PBKDF2 ( const __global unsigned int *pass_global,
              const __global unsigned int *salt,
              int usrlen,
              uint num_keys,
          __global unsigned int *out_global)
Which version of jtr are you using ? It seems you are using a very old version. Also I'm not familiar with pyOpencl.OpenCL initialization is quite complicated. You need to first allocate buffer spaces before you start transferring data from cpu to gpu. There are many other parameters which you might be setting wrong apart from the kernel arguments. Besides the opencl kernel has been tailored for use in mscash2 and so it might not be a generic one.  Here's the cpu version on which my opencl implementation is based. You might find it helpful.http://openwall.info/wiki/john/MSCash2    Regards,Sayantan
I use the implementation found in john-1.7.9-jumbo-7/src/opencl/pbkdf2_kernel.cl (see attachment) .
I know about initialization of OpenCL, even I had to dig, because pyopencl documentation is not that good. The buffers for strings (password, salt, output) have been initilized as required after being transformed (casted) into types like cl_int for opencl usage (as mentioned in the first mail).
pass_global_buf = cl.Buffer(ctx, cl.mem_flags.READ_WRITE, numpy_pass_global.nbytes)
salt_buf        = cl.Buffer(ctx, cl.mem_flags.READ_WRITE, numpy_salt.nbytes)
out_global_buf  = cl.Buffer(ctx, cl.mem_flags.WRITE_ONLY, numpy_out_global.nbytes)
...
cl.enqueue_copy(queue, pass_global_buf, numpy_pass_global, is_blocking=True)
cl.enqueue_copy(queue, salt_buf, numpy_salt, is_blocking=True)
...
prg.PBKDF2(queue, (1,), None, pass_global_buf, salt_buf ,numpy_usrlen, numpy_num_keys, out_global_buf).wait()
cl.enqueue_copy(queue, numpy_out_global, out_global_buf)
In fact, I think I did nothing wrong on python side.
Maybe the source of the problem is the tailored version of the implementation. I thought it is the generic implementation of pbkdf2. I pass a single array of uint values resulting from a array of char (like you use to say in C). The length is not constant. Maybe the tailored version of pbkdf2 expects some constant sized string?!
I am not familiar with mscash2, but will take a look on it.
Thank you so far.
Regards,
Marcus
Content of type "text/html" skipped

Download attachment "pbkdf2_kernel.cl" of type "application/octet-stream" (17238 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.