/extra/hashcash/hashcash-docs.factor

http://github.com/abeaumont/factor · Factor · 64 lines · 56 code · 8 blank · 0 comment · 0 complexity · fd2ad1ca65229ea13f1707b98c066a66 MD5 · raw file

  1. USING: help.markup help.syntax kernel math ;
  2. IN: hashcash
  3. ARTICLE: "hashcash" "Hashcash"
  4. "Hashcash is a denial-of-service counter measure tool."
  5. $nl
  6. "A hashcash stamp constitutes a proof-of-work which takes a parameterizable amount of work to compute for the sender. The recipient can verify received hashcash stamps efficiently."
  7. $nl
  8. "More info on hashcash:"
  9. $nl
  10. { $url "http://www.hashcash.org/" } $nl
  11. { $url "http://en.wikipedia.org/wiki/Hashcash" } $nl
  12. { $url "http://www.ibm.com/developerworks/linux/library/l-hashcash.html?ca=dgr-lnxw01HashCash" } $nl
  13. "This library provide basic utilities for hashcash creation and validation."
  14. $nl
  15. "Creating stamps:"
  16. { $subsections
  17. mint
  18. mint*
  19. }
  20. "Validation:"
  21. { $subsections check-stamp }
  22. "Hashcash tuple and constructor:"
  23. { $subsections
  24. hashcash
  25. <hashcash>
  26. }
  27. "Utilities:"
  28. { $subsections salt } ;
  29. { mint mint* <hashcash> check-stamp salt } related-words
  30. HELP: mint
  31. { $values { "resource" "a string" } { "stamp" "generated stamp" } }
  32. { $description "This word generate a valid stamp with default parameters and the specified resource." } ;
  33. HELP: mint*
  34. { $values { "tuple" "a tuple" } { "stamp" "generated stamp" } }
  35. { $description "As " { $snippet "mint" } " but it takes an hashcash tuple as a parameter." } ;
  36. HELP: check-stamp
  37. { $values { "stamp" "a string" } { "?" boolean } }
  38. { $description "Check for stamp's validity. Only supports hashcash version 1." } ;
  39. HELP: salt
  40. { $values { "length" integer } { "salted" "a string" } }
  41. { $description "It generates a random string of " { $snippet "length" } " characters." } ;
  42. HELP: <hashcash>
  43. { $values { "tuple" object } }
  44. { $description "It fill an hashcash tuple with the default values: 1 as hashcash version, 20 as bits, today's date as date and a random 8 character long salt" } ;
  45. HELP: hashcash
  46. { $class-description "An hashcash object. An hashcash have the following slots:"
  47. { $table
  48. { { $slot "version" } "The version number. Only version 1 is supported." }
  49. { { $slot "bits" } "The claimed bit value." }
  50. { { $slot "date" } "The date a stamp was minted." }
  51. { { $slot "resource" } "The resource for which a stamp is minted." }
  52. { { $slot "ext" } "Extensions that a specialized application may want." }
  53. { { $slot "salt" } "A random salt." }
  54. { { $slot "suffix" } "The computed suffix. This is supposed to be manipulated by the library." }
  55. }
  56. } ;