hashcash: strftime

char-rename
Björn Lindqvist 2017-01-03 22:39:24 +01:00
parent 8b56ff1b89
commit 40afb5268d
1 changed files with 5 additions and 7 deletions

View File

@ -1,9 +1,9 @@
! Copyright (C) 2009 Diego Martinelli. ! Copyright (C) 2009 Diego Martinelli.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors calendar calendar.format checksums USING: accessors calendar checksums checksums.openssl classes.tuple
checksums.openssl classes.tuple fry io.encodings.ascii formatting fry io.encodings.ascii io.encodings.string kernel math
io.encodings.string kernel math math.functions math.parser math.functions math.parser math.ranges present random sequences
math.ranges present random sequences splitting ; splitting ;
IN: hashcash IN: hashcash
! Hashcash implementation ! Hashcash implementation
@ -20,9 +20,7 @@ IN: hashcash
! Return a string with today's date in the form YYMMDD ! Return a string with today's date in the form YYMMDD
: get-date ( -- str ) : get-date ( -- str )
now [ year>> 100 mod pad-00 ] now "%y%m%d" strftime ;
[ month>> pad-00 ]
[ day>> pad-00 ] tri 3append ;
! Random salt is formed by ascii characters ! Random salt is formed by ascii characters
! between 33 and 126 ! between 33 and 126