X-Git-Url: https://git.distorted.org.uk/u/mdw/catacomb/blobdiff_plain/fe6657c961b01ec72e9f35f4c3d96b11b31cf09c..45c0fd363937c6e9b05da04a9167e9912c05ca0c:/has160.c diff --git a/has160.c b/has160.c index 727c01e..76c63aa 100644 --- a/has160.c +++ b/has160.c @@ -7,7 +7,7 @@ * (c) 2004 Straylight/Edgeware */ -/*----- Licensing notice --------------------------------------------------* +/*----- Licensing notice --------------------------------------------------* * * This file is part of Catacomb. * @@ -15,12 +15,12 @@ * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * Catacomb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with Catacomb; if not, write to the Free * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, @@ -89,38 +89,38 @@ void has160_compress(has160_ctx *ctx, const void *sbuf) */ #define ROUND(f, ss, k, \ - i0, i1, i2, i3, i4, i5, i6, i7, \ + i0, i1, i2, i3, i4, i5, i6, i7, \ i8, i9, i10, i11, i12, i13, i14, i15) do { \ FF(f, a, b, c, d, e, buf[ i8]^buf[ i9]^buf[i10]^buf[i11], 5, ss, k); \ - FF(f, e, a, b, c, d, buf[ i0], 11, ss, k); \ - FF(f, d, e, a, b, c, buf[ i1], 7, ss, k); \ - FF(f, c, d, e, a, b, buf[ i2], 15, ss, k); \ - FF(f, b, c, d, e, a, buf[ i3], 6, ss, k); \ + FF(f, e, a, b, c, d, buf[ i0], 11, ss, k); \ + FF(f, d, e, a, b, c, buf[ i1], 7, ss, k); \ + FF(f, c, d, e, a, b, buf[ i2], 15, ss, k); \ + FF(f, b, c, d, e, a, buf[ i3], 6, ss, k); \ FF(f, a, b, c, d, e, buf[i12]^buf[i13]^buf[i14]^buf[i15], 13, ss, k); \ - FF(f, e, a, b, c, d, buf[ i4], 8, ss, k); \ - FF(f, d, e, a, b, c, buf[ i5], 14, ss, k); \ - FF(f, c, d, e, a, b, buf[ i6], 7, ss, k); \ - FF(f, b, c, d, e, a, buf[ i7], 12, ss, k); \ + FF(f, e, a, b, c, d, buf[ i4], 8, ss, k); \ + FF(f, d, e, a, b, c, buf[ i5], 14, ss, k); \ + FF(f, c, d, e, a, b, buf[ i6], 7, ss, k); \ + FF(f, b, c, d, e, a, buf[ i7], 12, ss, k); \ FF(f, a, b, c, d, e, buf[ i0]^buf[ i1]^buf[ i2]^buf[ i3], 9, ss, k); \ - FF(f, e, a, b, c, d, buf[ i8], 11, ss, k); \ - FF(f, d, e, a, b, c, buf[ i9], 8, ss, k); \ - FF(f, c, d, e, a, b, buf[i10], 15, ss, k); \ - FF(f, b, c, d, e, a, buf[i11], 6, ss, k); \ + FF(f, e, a, b, c, d, buf[ i8], 11, ss, k); \ + FF(f, d, e, a, b, c, buf[ i9], 8, ss, k); \ + FF(f, c, d, e, a, b, buf[i10], 15, ss, k); \ + FF(f, b, c, d, e, a, buf[i11], 6, ss, k); \ FF(f, a, b, c, d, e, buf[ i4]^buf[ i5]^buf[ i6]^buf[ i7], 12, ss, k); \ - FF(f, e, a, b, c, d, buf[i12], 9, ss, k); \ - FF(f, d, e, a, b, c, buf[i13], 14, ss, k); \ - FF(f, c, d, e, a, b, buf[i14], 5, ss, k); \ - FF(f, b, c, d, e, a, buf[i15], 13, ss, k); \ + FF(f, e, a, b, c, d, buf[i12], 9, ss, k); \ + FF(f, d, e, a, b, c, buf[i13], 14, ss, k); \ + FF(f, c, d, e, a, b, buf[i14], 5, ss, k); \ + FF(f, b, c, d, e, a, buf[i15], 13, ss, k); \ } while (0) ROUND(F, 10, 0x00000000, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15); ROUND(G, 17, 0x5a827999, - 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13, 0); + 3, 6, 9, 12, 15, 2, 5, 8, 11, 14, 1, 4, 7, 10, 13, 0); ROUND(H, 25, 0x6ed9eba1, - 12, 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3); + 12, 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3); ROUND(G, 30, 0x8f1bbcdc, - 7, 2, 13, 8, 3, 14, 9, 4, 15, 10, 5, 0, 11, 6, 1, 12); + 7, 2, 13, 8, 3, 14, 9, 4, 15, 10, 5, 0, 11, 6, 1, 12); /* --- Update the chaining variables --- */ @@ -167,9 +167,9 @@ void has160_init(has160_ctx *ctx) void has160_set(has160_ctx *ctx, const void *buf, unsigned long count) { const octet *p = buf; - ctx->a = LOAD32_L(p + 0); - ctx->b = LOAD32_L(p + 4); - ctx->c = LOAD32_L(p + 8); + ctx->a = LOAD32_L(p + 0); + ctx->b = LOAD32_L(p + 4); + ctx->c = LOAD32_L(p + 8); ctx->d = LOAD32_L(p + 12); ctx->e = LOAD32_L(p + 16); ctx->off = 0; @@ -208,9 +208,9 @@ void has160_done(has160_ctx *ctx, void *hash) { octet *p = hash; HASH_MD5STRENGTH(HAS160, has160, ctx); - STORE32_L(p + 0, ctx->a); - STORE32_L(p + 4, ctx->b); - STORE32_L(p + 8, ctx->c); + STORE32_L(p + 0, ctx->a); + STORE32_L(p + 4, ctx->b); + STORE32_L(p + 8, ctx->c); STORE32_L(p + 12, ctx->d); STORE32_L(p + 16, ctx->e); } @@ -229,9 +229,9 @@ void has160_done(has160_ctx *ctx, void *hash) unsigned long has160_state(has160_ctx *ctx, void *state) { octet *p = state; - STORE32_L(p + 0, ctx->a); - STORE32_L(p + 4, ctx->b); - STORE32_L(p + 8, ctx->c); + STORE32_L(p + 0, ctx->a); + STORE32_L(p + 4, ctx->b); + STORE32_L(p + 8, ctx->c); STORE32_L(p + 12, ctx->d); STORE32_L(p + 16, ctx->e); return (ctx->nl | ((ctx->nh << 16) << 16));