factor/extra/crypto/common/common-docs.factor

31 lines
1.1 KiB
Factor
Raw Normal View History

2007-09-20 18:09:08 -04:00
USING: help.markup help.syntax kernel math sequences quotations
2008-01-11 00:48:04 -05:00
math.private ;
IN: crypto.common
2007-09-20 18:09:08 -04:00
HELP: >32-bit
2008-03-11 20:51:58 -04:00
{ $values { "x" integer } { "y" integer } }
2007-09-20 18:09:08 -04:00
{ $description "Used to implement 32-bit integer overflow." } ;
HELP: >64-bit
2008-03-11 20:51:58 -04:00
{ $values { "x" integer } { "y" integer } }
2007-09-20 18:09:08 -04:00
{ $description "Used to implement 64-bit integer overflow." } ;
HELP: bitroll
2008-03-11 20:51:58 -04:00
{ $values { "x" "an integer (input)" } { "s" "an integer (shift)" } { "w" "an integer (wrap)" } { "y" integer } }
2007-09-20 18:09:08 -04:00
{ $description "Roll n by s bits to the left, wrapping around after w bits." }
{ $examples
2008-03-11 20:51:58 -04:00
{ $example "USING: crypto.common prettyprint ;" "1 -1 32 bitroll .b" "10000000000000000000000000000000" }
{ $example "USING: crypto.common prettyprint ;" "HEX: ffff0000 8 32 bitroll .h" "ff0000ff" }
2007-09-20 18:09:08 -04:00
} ;
HELP: hex-string
{ $values { "seq" "a sequence" } { "str" "a string" } }
{ $description "Converts a sequence of values from 0-255 to a string of hex numbers from 0-ff." }
{ $examples
2008-03-11 20:51:58 -04:00
{ $example "USING: crypto.common io ;" "B{ 1 2 3 4 } hex-string print" "01020304" }
2007-09-20 18:09:08 -04:00
}
{ $notes "Numbers are zero-padded on the left." } ;