From: Björn Lindqvist Date: Tue, 3 Jan 2017 21:39:24 +0000 (+0100) Subject: hashcash: strftime X-Git-Tag: unmaintained~305 X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=40afb5268dd4a034821b1ce2ae52e9deb9fe7483 hashcash: strftime --- diff --git a/extra/hashcash/hashcash.factor b/extra/hashcash/hashcash.factor index 95a8b43d47..0342655172 100644 --- a/extra/hashcash/hashcash.factor +++ b/extra/hashcash/hashcash.factor @@ -1,9 +1,9 @@ ! Copyright (C) 2009 Diego Martinelli. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors calendar calendar.format checksums -checksums.openssl classes.tuple fry io.encodings.ascii -io.encodings.string kernel math math.functions math.parser -math.ranges present random sequences splitting ; +USING: accessors calendar checksums checksums.openssl classes.tuple +formatting fry io.encodings.ascii io.encodings.string kernel math +math.functions math.parser math.ranges present random sequences +splitting ; IN: hashcash ! Hashcash implementation @@ -20,9 +20,7 @@ IN: hashcash ! Return a string with today's date in the form YYMMDD : get-date ( -- str ) - now [ year>> 100 mod pad-00 ] - [ month>> pad-00 ] - [ day>> pad-00 ] tri 3append ; + now "%y%m%d" strftime ; ! Random salt is formed by ascii characters ! between 33 and 126