Technical details Hashcash




1 technical details

1.1 sender s side
1.2 recipient s side
1.3 required effort





technical details

the header line looks this:



x-hashcash: 1:20:1303030600:adam@cypherspace.org::mcmybzihxkxu57jd:ckvi

the header contains:



ver: hashcash format version, 1 (which supersedes version 0).
bits: number of partial pre-image (zero) bits in hashed code.
date: time message sent, in format yymmdd[hhmm[ss]].
resource: resource data string being transmitted, e.g., ip address or email address.
ext: extension (optional; ignored in version 1).
rand: string of random characters, encoded in base-64 format.
counter: binary counter (up 2), encoded in base-64 format.

the header contains recipient s email address, date of message, , information proving required computation has been performed. presence of recipient s email address requires different header computed each recipient. date allows recipient record headers received , ensure header unique email message.


sender s side

the sender prepares header , appends counter value initialized random number. computes 160-bit sha-1 hash of header. if first 20 bits (i.e. 5 significant hex digits) of hash zeros, acceptable header. if not, sender increments counter , tries hash again. out of 2 possible hash values, there 2 hash values satisfy criterion. chance of randomly selecting header have 20 zeros beginning of hash 1 in 2. number of times sender needs try before getting valid hash value modeled geometric distribution. hence sender on average have try 2 or @ worst more million counter values find valid header. given reasonable estimates of time needed compute hash, take 1 second find. @ time, no more efficient method known find valid header.


a normal user on desktop pc not inconvenienced processing time required generate hashcash string. however, spammers suffer due large number of spam messages sent them.


recipient s side

technically system implemented following steps:



the recipient s computer calculates 160-bit sha-1 hash of entire string (e.g., 1:20:060408:adam@cypherspace.org::1qtjayd7niiqa/sc:epa ). takes 2 microseconds on 1 ghz machine, far less time time takes rest of e-mail received. if first 20 bits not zero, hash invalid. (later versions may require more bits 0 machine processing speeds increase.)
the recipient s computer checks date in header (e.g., 060408 , represents date 8 apr 2006). if not within 2 days of current date, invalid. (the two-day window compensates clock skew , network routing time between different systems.)
the recipient s computer checks whether e-mail address in hash string matches of valid e-mail addresses registered recipient, or matches of mailing lists recipient subscribed. if match not found, hash string invalid.
the recipient s computer inserts hash string database. if string in database (indicating attempt being made re-use hash string), invalid.

if hash string passes of these tests, considered valid hash string. of these tests take far less time , disk space receiving body content of e-mail.


required effort

the time needed compute such hash collision exponential number of 0 bits. 0 bits can added (doubling amount of time needed compute hash each additional 0 bit) until expensive spammers generate valid header lines.


confirming header valid takes same amount of time, no matter how many 0 bits required valid header, since requires single hashing operation.








Comments

Popular posts from this blog

Life and work Ustad Mansur

Examples Wreath product

Kiev 35 mm cameras Kiev (brand)