]> gitweb.factorcode.org Git - factor.git/commitdiff
hashcash: strftime
authorBjörn Lindqvist <bjourne@gmail.com>
Tue, 3 Jan 2017 21:39:24 +0000 (22:39 +0100)
committerBjörn Lindqvist <bjourne@gmail.com>
Wed, 4 Jan 2017 07:11:01 +0000 (08:11 +0100)
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