]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/hashcash/hashcash.factor
hashcash: strftime
[factor.git] / extra / hashcash / hashcash.factor
index 95a8b43d47b17c51624e938d65873dce84df58ba..03426551721250746c8c12a8361fa0bef22fdfc7 100644 (file)
@@ -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