FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.

» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

LinkBack Thread Tools
Old 03-21-2011, 08:08 PM
Aaron Toponce
Default Hashcash token does not represent bits calculated

Package: hashcash
Version: 1.21-1

According to the documentation, the hashcash binary supports the '-b
bits' switch and argument for calculating a hashcash token of the size
specified. The default size is 20 bits. The '-b' switch argument
supports an exact size, say '-b 40' for minting a 40 bit token, or
incrementing/decrementing the size from default, such as '-b +10' to
create an additional 10 bits from default (20). This should create a
token of 30 bits in size. Same holds for decrementing.

Consider the following example:

$ hashcash -m foo -Z 2
hashcash token: 1:20:110321:foo:MOAOyoyMfeKOPg7:5z7t

As per the 2nd column of the token, the default of 20 bits was used.
Let's increase to 30 bits:

$ hashcash -m foo -b 30 -Z 2
hashcash token: 1:20:110321:foo:PuJxVpBd5hjE+WX:7CR2

The 2nd colomn shows that only 20 bits were calculated, versus the 30
that I requested. This can be verified with SHA1 showing that the first
20 bits are zero, not the first 30:

$ echo -n 1:20:110321:foo:PuJxVpBd5hjE+WX:7CR2 | sha1sum
00000239da10b8f4cf3aadd15d62b2d0c261dc82 -

The same bug exists for incrementing and decrementing the bit size. The
2nd column should convey the bit size that I requested with '-b bits'
and verifying with SHA1 should show the firt few bits as zero, as
specified. Compare with a 44 bit token found at

$ echo -n 1:44:070217:foo::xSi0bPjoswUh6h1Y:TMNI7 | sha1sum
000000000005ae959bd508c19ba300b1088410aa -

This is a Debian GNU/Linux unstable operating system running with:

2.6.37-1-686 #1 SMP Tue Feb 15 18:21:50 UTC 2011 i686 GNU/Linux

With C library version:

Version: 2.11.2-11

. o . o . o . . o o . . . o .
. . o . o o o . o . o o . . o
o o o . o . . o o o o . o o o

Thread Tools

All times are GMT. The time now is 01:18 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org