Wednesday, September 27, 2006

_XOPEN_SOURCE usage and crypt

The manpage of crypt(3) says to define #define _XOPEN_SOURCE then #include <unistd.h>. The magic takes place in features.h, which eventually causes __USE_XOPEN to be set. It is important that the #define take place before any other #includes, for example stdio.h, which might indirectly include features.h, or in the command line via -D_XOPEN_SOURCE.

Running time is approximately 0.00067 seconds. Thus 4 characters [a..z] is 5 minutes, 5 chars 2.2 hours, 6 chars 2.4 days, 7 chars 60 days, 8 chars 4.4 years. The [a-z] character set is useful because it is easily searchable with perl for("aaa".."zzz) for a simple CPU challenge.

Is it worth it to really pipeline successive calls to crypt(). Or are the internal loops already pipelined and long enough?

No comments :