chiark / gitweb /
ulong improved; clock arithmetic hbytes abolished; secnet responder implemented and...
[chiark-tcl.git] / hbytes / hbytes.h
index c9975f2adea212c8fd1602dcb0c6a9bd2e73bbf4..0f38890875e7ad304be3dda64f073fd6610a39d8 100644 (file)
  *  hbytes trimleft VAR                         removes any leading 0 octets
  *  hbytes repeat VALUE COUNT                    => COUNT copies of VALUE
  *
- *  hbytes clockincrement VAR INTEGER      adds INTEGER to VAR mod 256^|VAR|
- *                                         INTEGER must be -255 .. 255
- *                                               => carry (-255 to 255,
- *                                               and -1,0,1 if VAR not empty)
- *
- *  hbytes h2ulong HEX                           => ulong  (HEX len must be 4)
- *  hbytes ulong2h UL                            => hex
- *
- *  ulong ul2bitfields VALUE [SIZE TYPE [TYPE-ARG...] ...]  => 0/1
- *  ulong bitfields2ul BASE  [SIZE TYPE [TYPE-ARG...] ...]  => ULONG
- *      goes from left (MSbit) to right (LSbit) where
- *            SIZE is size in bits
- *            TYPE [TYPE-ARGS...] is as below
- *               zero
- *               ignore
- *               fixed ULONG-VALUE
- *               uint VARNAME/VALUE         (VARNAME if ul2bitfields;
- *               ulong VARNAME/VALUE         VALUE if bitfields2ul)
- *
- *  ulong ul2int ULONG    => INT            can fail if >INT_MAX
- *  ulong int2ul INT      => ULONG          can fail if <0
- *
- *  hbytes shift l|r ULONG BITS             fails if BITS >32
- *  hbytes mask A B                         => A & B
+ *  hbytes ushort2h LONG           => LONG must be <2^16, returns as hex
+ *  hbytes h2ushort HEX            => |HEX| must be 2 bytes, returns as ulong
  *
  *  hbytes compare A B
  *      =>  -2   A is lexically earlier than B and not a prefix of B  (A<B)
  *  hbytes hash ALG MESSAGE                      => hash
  *  hbytes hmac ALG MESSAGE KEY [MACLENGTH]      => mac
  *
+ *  ulong ul2int ULONG    => INT           can fail if >INT_MAX
+ *  ulong int2ul INT      => ULONG         can fail if <0
+ *  ulong mask A B                         => A & B
+ *  ulong add A B                          => A + B  (mod 2^32)
+ *  ulong subtract A B                     => A - B  (mod 2^32)
+ *  ulong compare A B                      => 0/-1/1
+ *  ulong shift l|r ULONG BITS             fails if BITS >32
+ *
+ *  ulong ul2bitfields VALUE [SIZE TYPE [TYPE-ARG...] ...]  => 0/1
+ *  ulong bitfields2ul BASE  [SIZE TYPE [TYPE-ARG...] ...]  => ULONG
+ *      goes from left (MSbit) to right (LSbit) where
+ *            SIZE is size in bits
+ *            TYPE [TYPE-ARGS...] is as below
+ *               zero
+ *               ignore
+ *               fixed ULONG-VALUE
+ *               uint VARNAME/VALUE         (VARNAME if ul2bitfields;
+ *               ulong VARNAME/VALUE         VALUE if bitfields2ul)
+ *
  * Refs: HMAC: RFC2104
  */