+(defun hashcash-version (token)
+ "Find the format version of a hashcash token."
+ ;; Version 1.2 looks like n:yymmdd:rrrrr:xxxxxxxxxxxxxxxx
+ ;; This carries its own version number embedded in the token,
+ ;; so no further format number changes should be necessary
+ ;; in the X-Payment header.
+ ;;
+ ;; Version 1.1 looks like yymmdd:rrrrr:xxxxxxxxxxxxxxxx
+ ;; You need to upgrade your hashcash binary.
+ ;;
+ ;; Version 1.0 looked like nnnnnrrrrrxxxxxxxxxxxxxxxx
+ ;; This is no longer supported.
+ (cond ((equal (aref token 1) ?:) 1.2)
+ ((equal (aref token 6) ?:) 1.1)
+ (t (error "Unknown hashcash format version"))))
+