[Toybox] [CLEANUP] mkpasswd.c

Rob Landley rob at landley.net
Thu Jun 26 05:18:31 PDT 2014


On 06/26/14 00:20, Isaac Dunham wrote:
> On Wed, Jun 25, 2014 at 11:02:03PM -0500, Rob Landley wrote:
>> We don't need "-m help" when we can put the list of supported types in
>> the help text itself. (Unless this is used programmatically to
>> autodetect support? The ubuntu version outputs a lot of extra verbiage
>> that would make parsing hard, and the busybox-1.19.0 I have lying around
>> doesn't support -m help at all?) I've yanked it for now, I can put -m
>> help back if anybody's actually using it...
> 
> I'd just been looking into bcrypt support, where it theoretically
> could be handy. bcrypt is supported on musl, some patched versions
> of glibc, and a lot of non-linux systems.
> To support it, we can either advertise bcrypt support everywhere and
> fail sometimes or else probe for it.

Probing would be ideal, except that I'm not sure how you'd probe while
cross-compiling? (I can probe for a function existing, but not for
crypt() accepting an argument value. One's a build break, the other
requires executing code to see what it does.)

> Relevant information:
> bcrypt is obtained via a salt starting with:
> $2y$NN$
> where NN is a 2-digit number not less than 04 nor more than 31 (at present),
> limiting the number of rounds.
> musl limits it a bit lower (I think ~20?); even 16 rounds takes a looonnnnggg
> time on an Atom N270 at 1.6 GHz, while 4-8 rounds is practically instant.
> 
> I'd suggest setting rounds to 8 at minimum, 12 at maximum.

That's sounding nonlinear... ah, wikipedia says it's 2^cost iterations,
so yeah. Exponential.

> Following this you need 22 characters of the usual sort for a salt;
> traditionally it's terminated with a '$', but musl at least does not
> require this.
> 
> Thanks,
> Isaac Dunham

Patches welcome. I'm unlikely to add that myself but I'm happy to merge
it if other people think it useful.

Probably not this release though. I'm aiming for mondayish and focusing
on cleanup of what's already in the tree just now...

Rob

 1403785111.0


More information about the Toybox mailing list