bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#11085: factor only supports decimal numbers, doh


From: Adam Back
Subject: bug#11085: factor only supports decimal numbers, doh
Date: Sun, 25 Mar 2012 15:23:01 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Hi,
Thanks for replying.  I am aware of bc, dc etc.  And in fact that was what I
did to work around (used bc), but it seems like unnecessary feature removal
when the underlying crypto library the tool is calling to actually do the
work is more natively working with hex (binary).

Sorry about getting off on the wrong foot with the "stupid" word mixed into
my thought.

I have been using unix exclusively since 1989, and yes I am a fan of the
unix philosophy.  I would qualify "it is possible to use other tools to work
around the lack of this feature" to more the tools are scalable,
conveniently pluggable etc.  And convenient pluggability applies IMO.

Eg lets say od can output in different formats (-tx1 I use commonly if I
need convert a file into something suitable to chain with some other crypto
command line tool) ...  you "could" no doubt work around that with awk, perl
or maybe even bc if you were creative, but it just makes things less
convenient to chain if the default or only output is not directly
compatibile with the main consuming next in the chain tools natural, default
or only input...

Adam

On Sun, Mar 25, 2012 at 09:54:39AM +0200, Jim Meyering wrote:
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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]