Hashing macros for strings and integers.
[u/mdw/catacomb] / catcrypt.c
index 4e54712..967730a 100644 (file)
@@ -276,8 +276,7 @@ static int encrypt(int argc, char *argv[])
   seq = 0;
   for (;;) {
     h = GM_INIT(m);
-    STORE32(bb, seq);
-    GH_HASH(h, bb, 4);
+    GH_HASHU32(h, seq);
     seq++;
     if (GC_CLASS(c)->blksz) {
       GC_ENCRYPT(cx, 0, bb, GC_CLASS(c)->blksz);
@@ -487,8 +486,7 @@ static int decrypt(int argc, char *argv[])
       GC_SETIV(c, d.buf);
     }
     h = GM_INIT(m);
-    STORE32(d.buf, seq);
-    GH_HASH(h, d.buf, 4);
+    GH_HASHU32(h, seq);
     seq++;
     chunk_read(e, &d, &b);
     if ((tag = buf_get(&b, GM_CLASS(m)->hashsz)) == 0) {