Subject: Re: bug#11085: factor only supports decimal numbers, doh

From: Jim Meyering <[email-masked]>
Date: Sun, 25 Mar 2012 09:54:39 +0200

Adam Back wrote:
> Which is stupid because in most cryptographic applications, which is the
> main practical use of factor, if people are going to include this in
> distrubitons, use hexadecimal.  The underlying crypto library obviously

A feature request that starts with "your implementation is stupid..."
generally doesn't get far, even when it has merit.

What would be near-sighted (I wouldn't say "stupid")
would be to add explicit support for hexadecimal input
when you can get the same effect via your shell:

  factor $((0x1fffffffffffffff))

If the input is larger than 2^64, use bc or dc:

  factor $(echo 'ibase=16; FFFFFFFFFFFFFFFFF' |bc)

> supports hex and its is more native number system anyway, so please enable
> hex numbers.  eg 0xF it might be nice if the factors were in the same base
> as the input, or if there was a flag to control the output radix...

You might have heard about the Unix Philosophy?
It is about connecting tools like factor and bc or your shell
so that we don't have to duplicate base-conversion functionality
in every tool that accepts an integer input.  Similarly, if you
require hexadecimal output, use printf %x for small numbers or
bc/dc/perl/python to convert.