Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 10 Dec 2012 03:15:59 +0100
From: magnum <>
Subject: Re: fixing the valid() methods

On 10 Dec, 2012, at 2:57 , Solar Designer <> wrote:
> Additionally, during the Openwall meetup in November, Alexander and
> Aleksey suggested that if folks (especially Dhiru) tend not to write
> proper valid() or to make errors there, maybe this suggests that we
> should provide a simpler way.  Specifically, it was mentioned that (as I
> understood the suggestion) formats.c could provide a generic function
> that would be callable from valid() and that would accept a regexp.
> Its use would be something like:
> #define CIPHERTEXT_REGEXP "^somethinghere$"
> static int valid(char *ciphertext, struct fmt_main *self)
> {
> 	return fmt_generic_valid(ciphertext, CIPHERTEXT_REGEXP);
> }
> ...or maybe we could have a "char *ciphertext_regexp" field, which the
> loader would check against before calling valid().  (Not everything can
> be represented with a regexp, so support for valid() would need to
> remain.)
> Can we afford a dependency on regcomp(3), regexec(3), regfree(3) in
> jumbo?  Apparently, these are in POSIX.1-2001.  Yet I am unlikely to
> introduce this change to core, so it'd be yet another jumbo thing.

I fear it may be slow. Again, think about millions of hashes. I think once a developer finds a good "master" to copy, the problem is gone. Dhiru, try concentrating on just one format's valid() and try to write in a way that will be easy to re-use in other formats. Then have it reviewed here before proceeding with more formats. /me and others will likely learn something from this discussion too.


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.