Hashcash: Difference between revisions
not sure why someone deleted, please stop! re-add bitcoin use case, hashcash is more widely known for its use in bitcoin than for email spam at this point |
fix wording around: hashcash is not "an email header" its a crypto algorithm, that for email applications is encoded into an email header |
||
Line 2: | Line 2: | ||
==How it works== |
==How it works== |
||
Hashcash is a |
Hashcash is a proof-of-work algorithm that requires a selectable amount of work to compute, but the proof can be verified efficiently. For email uses, a textual encoding of a hashcash stamp is added to the [[header (computing)|header]] of an email to prove the sender has expended a modest amount of CPU time calculating the stamp prior to sending the email. In other words, as the sender has taken a certain amount of time to generate the stamp and send the email, it is unlikely that they are a spammer. The receiver can, at negligible computational cost, verify that the stamp is valid. However, the only known way to find a header with the necessary properties is [[Brute force attack|brute force]], trying random values until the answer is found; though testing an individual string is easy, if satisfactory answers are rare enough it will require a substantial number of tries to find the answer. |
||
The hypothesis is that spammers, whose business model relies on their ability to send large numbers of emails with very little cost per message, will cease to be profitable if there is even a small cost for each spam they send. Receivers can verify whether a sender made such an investment and use the results to help filter email. |
The hypothesis is that spammers, whose business model relies on their ability to send large numbers of emails with very little cost per message, will cease to be profitable if there is even a small cost for each spam they send. Receivers can verify whether a sender made such an investment and use the results to help filter email. |
Revision as of 10:32, 21 February 2015
Hashcash is a proof-of-work system used to limit email spam and denial-of-service attacks; and as the mining algorithm in bitcoin. Hashcash was proposed in May 1997 by Adam Back.[1]
How it works
Hashcash is a proof-of-work algorithm that requires a selectable amount of work to compute, but the proof can be verified efficiently. For email uses, a textual encoding of a hashcash stamp is added to the header of an email to prove the sender has expended a modest amount of CPU time calculating the stamp prior to sending the email. In other words, as the sender has taken a certain amount of time to generate the stamp and send the email, it is unlikely that they are a spammer. The receiver can, at negligible computational cost, verify that the stamp is valid. However, the only known way to find a header with the necessary properties is brute force, trying random values until the answer is found; though testing an individual string is easy, if satisfactory answers are rare enough it will require a substantial number of tries to find the answer.
The hypothesis is that spammers, whose business model relies on their ability to send large numbers of emails with very little cost per message, will cease to be profitable if there is even a small cost for each spam they send. Receivers can verify whether a sender made such an investment and use the results to help filter email.
Technical details
The header line looks something like this:[2]
X-Hashcash: 1:20:1303030600:adam@cypherspace.org::McMybZIhxKXu57jd:FOvXX
The header contains: the recipient's email address, the date, and information proving the required computation has been performed. The presence of the recipient's email address requires that a new header be computed for each recipient, and the date allows the recipient to record headers received recently and make sure the header is unique to this email.
Sender's side
The sender prepares a header and adds an initial random number. It then computes the 160 bit SHA-1 hash of the header. If the first 20 bits of the hash are zeros, then this is an acceptable header. If not, then the sender increments the random number and tries again. Out of 2160 possible hash values, there are 2140 hash values that satisfy this criterion. Thus the chance of randomly selecting a header that will have 20 zeros as the beginning of the hash is 1 in 220. The number of times that the sender needs to try before getting a valid hash value is modeled by geometric distribution. Hence the sender will on average have to try 220 random numbers to find a valid header. Given reasonable estimates of the time needed to compute the hash,[as of?] this would take about 1 second to find. At this time, no more efficient method is known to find a valid header.
A normal user on a desktop PC would not be significantly inconvenienced by the processing time required to generate the Hashcash string. However, spammers would suffer significantly due to the large number of spam messages sent by them.
Recipient's side
Technically the system is implemented with the following steps:
- The recipient's computer calculates the 160-bit SHA-1 hash of the entire string (e.g.,
"1:20:060408:adam@cypherspace.org::1QTjaYd7niiQA/sc:ePa"
). This takes about two microseconds on a 1 GHz machine, far less time than the time it takes for the rest of the e-mail to be received. If the first 20 bits are not all zero, the hash is invalid. (Later versions may require more bits to be zero as machine processing speeds increase.) - The recipient's computer checks the date in the header (e.g.,
"060408"
, which represents the date 8 Apr 2006). If it is not within two days of the current date, it is invalid. (The two-day window compensates for clock skew and network routing time between different systems.) - The recipient's computer checks whether the e-mail address in the hash string matches any of the valid e-mail addresses registered by the recipient, or matches any of the mailing lists to which the recipient is subscribed. If a match is not found, the hash string is invalid.
- The recipient's computer inserts the hash string into a database. If the string is already in the database (indicating that an attempt is being made to re-use the hash string), it is invalid.
If the hash string passes all of these tests, it is considered a valid hash string. All of these tests take far less time and disk space than receiving the body content of the e-mail.
Required effort
The time needed to compute such a hash collision is exponential with the number of zero bits. So zero bits can be added (doubling the amount of time needed to compute a hash with each additional zero bit) until it is too expensive for spammers to generate valid header lines.
Confirming that the header is valid always takes the same amount of time, no matter how many zero bits are required for a valid header, since this requires only a single hashing operation.
Advantages and disadvantages
This section needs additional citations for verification. (August 2010) |
The Hashcash system has the advantage over micropayment proposals applying to legitimate email that no real money is involved. Neither the sender nor recipient need to pay, thus the administrative issues involved with all micropayment systems are entirely avoided.
On the other hand, as Hashcash requires potentially significant computational resources to be expended on each e-mail being sent, it is somewhat difficult to tune the ideal amount of average time you wish clients to expend computing a valid header. This can mean sacrificing accessibility from low-end embedded systems or else running the risk of hostile hosts not being challenged enough to provide an effective filter from spam.
Hashcash is also fairly simple to implement in mail user agents and spam filters. No central server is needed. Hashcash can be incrementally deployed—the extra Hashcash header is ignored when it is received by mail clients that do not understand it.
One plausible analysis[3] concluded that only one of the following cases is likely: either non-spam e-mail will get stuck due to lack of processing power of the sender, or spam e-mail is bound to still get through. Examples of each include, respectively, a centralized e-mail topology (like a mailing list), in which some server is to send an enormous amount of legitimate e-mails, and botnets or cluster farms with which spammers can increase their processing power enormously.
Most of these issues may be addressed. E.g., botnets may expire faster because users notice the high CPU load and take counter-measures, and mailing list servers can be registered in white lists on the subscribers' hosts and thus be relieved from the hashcash challenges. But they represent serious obstacles to hashcash deployment that remain to be addressed.[citation needed]
Another projected problem is that computers continue to get faster according to Moore's law. So the difficulty of the calculations required must be increased over time. However, developing countries can be expected to use older hardware, which means that they will find it increasingly difficult to participate in the email system. This also applies to lower-income individuals in developed countries who cannot afford the latest hardware.
Applications
Bitcoin mining
Hashcash is the proof-of-work system used for bitcoin mining. Where hashcash in mail applications relies on the recipients to manually adjust required amount of work for the proof-of-work for advances in compute power due to moore's law, bitcoin introduces a p2p network that internally automatically adjusts the amount of work. Where email proofs of work were proposed at a modest and cheap to produce 20-bits (2^20 = 1 million tries to produce) bitcoin as of February 2015 requires 67.5bits (2^6.75 = 200 million trillion tries to produce) to mine a block which includes a reward of currently 25 bitcoin, that are produced to a target of every 10 minutes.
Bitcoin makes a minor adjustment to "Hashcash". to support more precise work in fractions of a bit (the original hashcash specification for simplicity limits work adjustment to whole powers of 2).
Spam filters
Hashcash is used as a potential solution for false positives with automated spam filtering systems, as legitimate users will rarely be inconvenienced by the extra time it takes to mint a stamp.[4] SpamAssassin has checked for Hashcash stamps since version 2.70, assigning a negative score (i.e. less likely to be spam) for valid, unspent Hashcash stamps. In the 3.3.x series (the current version at time of writing), it gives a bonus for any stamp 20 bits or greater, capping at -5 points for a stamp 26 bits or greater; however, an already-spent stamp incurs a small penalty.[5]
Email clients
The Penny Post software project[6] on SourceForge implements Hashcash in the Mozilla Thunderbird email client.[7] The project is named for the historical availability of conventional mailing services that cost the sender just one penny; see Penny Post for information about such mailing services in history.
Email Postmark
Microsoft also designed and implemented a now deprecated[8] open spec, similar to and yet incompatible with Hashcash, Email Postmark, [9] as part of their Coordinated Spam Reduction Initiative (CSRI).[10] The Microsoft email postmark variant of Hashcash is implemented in the Microsoft mail infrastructure components Exchange, Outlook and Hotmail. The format differences between Hashcash and Microsoft's email postmark is that postmark hashes the body in addition to the recipient, and uses a modified SHA-1 as the hash function and uses multiple sub-puzzles to reduce proof of work variance.
Blogs
Like e-mail, blogs often fall victim to comment spam. Some blog owners have used hashcash scripts written in the JavaScript language to slow down comment spammers.[11] Some scripts (such as wp-hashcash) claim to implement hashcash but instead depend on JavaScript obfuscation to force the client to generate a matching key; while this does require some processing power, it does not use the hashcash algorithm or hashcash stamps.
Intellectual property
This section may require cleanup to meet Wikipedia's quality standards. The specific problem is: a number of oddities were recently fixed in this section, but the one fixing them was not familiar with all of Wikipedia's guidelines and writing styles, so it is very likely that some still remain. (February 2014) |
Hashcash is not patented, and the reference implementation[12] and most of the other implementations are open-source. Hashcash is included or available for many Linux distributions.
RSA has made IPR statements to the IETF about client-puzzles[13] in the context of an RFC[14] that described client-puzzles (not hashcash). The RFC included hashcash in the title and referenced hashcash, but the mechanism described in it is a known-solution interactive challenge which is more akin to Client-Puzzles; hashcash is non-interactive and therefore does not have a known solution. In any case RSA's IPR statement can not apply to hashcash because hashcash predates[1] (March 1997) the client-puzzles publication[15] (Feb 1999) and the client-puzzles patent filing US7197639[16] (February 2000).
See also
Notes
- ^ a b "A partial hash collision based postage scheme" (Txt). Hashcash.org. Retrieved 13 October 2014.
- ^ "hashcash - hashcash anti-spam / denial of service counter-measure tool" (Txt). Hashcash.org. Retrieved 13 October 2014.
- ^ "Hashcash proof-of-work paper" (PDF). Hashcash.org. Retrieved 13 October 2014.
- ^ "Hashcash FAQ". Hashcash.org. 2003-06-26. Retrieved 2014-02-11.
- ^ "SpamAssassin: Tests Performed: v3.3.x". Spamassassin.apache.org. 2006-12-21. Retrieved 2014-02-11.
- ^ "Penny Post software project on SourceForge". Pennypost.sourceforge.net. Retrieved 13 October 2014.
- ^ "Penny Post: What do you mean by Postage Stamp?". Pennypost.sourceforge.net. 2008-06-16. Retrieved 2014-02-11.
- ^ "Discontinued features and modified functionality in Outlook 2010". Office.microsoft.com. Retrieved 13 October 2014.
- ^ "Email Postmark Validation Algorithm" (PDF). Download.microdoft.com. Retrieved 13 October 2014.
- ^ "The Coordinated Spam Reduction Initiative: A Technology and Policy Proposal" (PDF). Retrieved 2014-02-11.
- ^ WP-Hashcash, a plugin for Wordpress blog software that implements a Hashcash-like facility, written in JavaScript, by Elliott Back
- ^ "C reference implementation". hashcash.org. Retrieved 13 October 2014.
- ^ "RSA Security Inc. has submitted a patent application (US Serial No. 09/496,824)" (Txt). Ietf.org. Retrieved 13 October 2014.
{{cite web}}
: line feed character in|title=
at position 58 (help) - ^ "SIP Computational Puzzles". Tools.ietf.org. Retrieved 13 October 2014.
- ^ "Client Puzzles" (PDF). Retrieved 13 October 2014.
- ^ "Client-puzzle patent filing". Google.com. Retrieved 13 October 2014.
References
- Adam Back, "Hashcash - A Denial of Service Counter-Measure", technical report, August 2002 (PDF).
- Ben Laurie and Richard Clayton, "'Proof-of-Work' Proves Not to Work", WEIS 04. (PDF).
- Dwork, C. and Naor, M. (1992) "Pricing via Processing or Combating Junk Mail", Crypto '92, pp. 139–147. (PDF)