factor/extra/crypto/common/common.factor

18 lines
444 B
Factor
Raw Normal View History

2008-06-09 06:22:21 -04:00
USING: arrays kernel io io.binary sbufs splitting grouping
strings sequences namespaces math math.parser parser
2008-09-05 20:29:14 -04:00
hints math.bitwise assocs ;
2007-09-20 18:09:08 -04:00
IN: crypto.common
: (nth-int) ( string n -- int )
2 shift dup 4 + rot <slice> ; inline
: nth-int ( string n -- int ) (nth-int) le> ; inline
: update ( num var -- ) [ w+ ] change ; inline
SYMBOL: big-endian?
: mod-nth ( n seq -- elt )
#! 5 "abcd" -> b
2008-04-03 14:57:33 -04:00
[ length mod ] [ nth ] bi ;