X-Git-Url: https://git.cryptolib.org/?a=blobdiff_plain;ds=sidebyside;f=cubehash%2Fcubehash.c;h=bb5852c185e97dc9b454329e9a9c833e2088c7a9;hb=f078dc4f51afdd67e888869fa5d9e93571ea354f;hp=997378f912ef15f6ac318d85345bdbad3f802932;hpb=25ccd391d2f02575799e94bf9aac1e108e7c0f3b;p=avr-crypto-lib.git diff --git a/cubehash/cubehash.c b/cubehash/cubehash.c index 997378f..bb5852c 100644 --- a/cubehash/cubehash.c +++ b/cubehash/cubehash.c @@ -28,12 +28,10 @@ #include "memxor.h" #include "cubehash.h" +#include "cubehash_rotates.h" #include #include -static uint32_t rol32(uint32_t a, uint8_t r){ - return (a<>(32-r)); -} /* • Add x_0jklm into x_1jklm modulo 232 , for each (j, k, l, m). • Rotate x_0jklm upwards by 7 bits, for each (j, k, l, m). @@ -52,9 +50,7 @@ static void cubehash_round(cubehash_ctx_t* ctx){ uint32_t t; for(i=0; i<16; ++i){ ctx->a[i+16] += ctx->a[i]; - } - for(i=0; i<16; ++i){ - ctx->a[i] = rol32(ctx->a[i], 7); + ctx->a[i] = rotate7left(ctx->a[i]); } for(i=0; i<8; ++i){ t = ctx->a[i]; @@ -74,9 +70,7 @@ static void cubehash_round(cubehash_ctx_t* ctx){ } for(i=0; i<16; ++i){ ctx->a[i+16] += ctx->a[i]; - } - for(i=0; i<16; ++i){ - ctx->a[i] = rol32(ctx->a[i], 11); + ctx->a[i] = rotate11left(ctx->a[i]); } for(i=0; i<4; ++i){ t = ctx->a[i];