Re: SHA-512 and 128-bit integers
From: Benjamin Goldberg (goldbb2_at_earthlink.net)
Date: 04/29/03
- Next message: terminal: "Laurent Gobeaux"
- Previous message: terminal: "when the rain begins to fall"
- In reply to: Ken Very Big Liar: "SHA-512 and 128-bit integers"
- Next in thread: Douglas A. Gwyn: "Re: SHA-512 and 128-bit integers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Tue, 29 Apr 2003 15:42:44 -0400
Ken Very Big Liar wrote:
>
> Ok, does anyone have a good solution to using 128-bit integers on 32
> bit machines?
Well, if you need a *full* set of arithmetic operations (add, subtract,
multiply, divide, modulo, pow, log, etc.) for your 128-bit integers,
then I would suggest that you get a bignum library.
> The Linux Pent III that I'm using to develop the different SHAs
> supports the C type "long long", which is a 64-bit type, but there is
> no support for 128-bit integers. Probably because there is no machine
> code for this, I'm not sure.
Indeed -- there are few, if any, machines with opcodes designed for 128
bit math.
Fortunatly, if you only need addition of 128-bit ints and 32-bit ints,
you can do:
typedef uint32 int128[4];
#define add128(a, b) \
((a[0] += (b)) >= (b)) || ++a[1] || ++a[2] || ++a[3])
> I noticed that the even Tom's crypt library sidesteps this issue by
> hoping that you won't be using huge data sets.
Ehh, what are you talking about?
> That's fine I guess, but I wanted to take a quick poll out there to see
> what others have come up with. An unsigned 64-bit integer has a
> maximum value of 18,446,744,073,709,551,615.
Which is actually 18,446,744,073,709,551,616 different possible values.
> Divide that up by 8 (the traditional number of bits in a byte) and you
> get 2,305,843,009,213,693,951. Ok, a pretty huge number. Nevermind.
> ;-)
Why are you dividing 2^64 by 8?
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
- Next message: terminal: "Laurent Gobeaux"
- Previous message: terminal: "when the rain begins to fall"
- In reply to: Ken Very Big Liar: "SHA-512 and 128-bit integers"
- Next in thread: Douglas A. Gwyn: "Re: SHA-512 and 128-bit integers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|