Lines Matching +full:15 +full:- +full:input
2 * Copyright (C) 2021 - This file is part of libecc project
18 * 32-bit integer manipulation macros (big endian)
41 * 64-bit integer manipulation macros (big endian)
58 #define ROTL_RIPEMD160(x, n) ((((u32)(x)) << (n)) | (((u32)(x)) >> (32-(n))))
77 { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
78 { 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8 },
79 { 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12 },
80 { 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2 },
81 { 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 }
84 { 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8 },
85 { 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12 },
86 { 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5 },
87 { 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12 },
88 { 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 }
93 { 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12 },
94 { 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2 },
95 { 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13 },
96 { 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14 },
97 { 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 }
100 { 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6 },
101 { 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11 },
102 { 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5 },
103 { 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8 },
104 { 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 }
131 al = ar = ctx->ripemd160_state[0]; in ripemd160_process()
132 bl = br = ctx->ripemd160_state[1]; in ripemd160_process()
133 cl = cr = ctx->ripemd160_state[2]; in ripemd160_process()
134 dl = dr = ctx->ripemd160_state[3]; in ripemd160_process()
135 el = er = ctx->ripemd160_state[4]; in ripemd160_process()
169 tt = (ctx->ripemd160_state[1] + cl + dr); in ripemd160_process()
170 ctx->ripemd160_state[1] = (ctx->ripemd160_state[2] + dl + er); in ripemd160_process()
171 ctx->ripemd160_state[2] = (ctx->ripemd160_state[3] + el + ar); in ripemd160_process()
172 ctx->ripemd160_state[3] = (ctx->ripemd160_state[4] + al + br); in ripemd160_process()
173 ctx->ripemd160_state[4] = (ctx->ripemd160_state[0] + bl + cr); in ripemd160_process()
174 ctx->ripemd160_state[0] = tt; in ripemd160_process()
189 ctx->ripemd160_total = 0; in ripemd160_init()
190 ctx->ripemd160_state[0] = 0x67452301; in ripemd160_init()
191 ctx->ripemd160_state[1] = 0xefcdab89; in ripemd160_init()
192 ctx->ripemd160_state[2] = 0x98badcfe; in ripemd160_init()
193 ctx->ripemd160_state[3] = 0x10325476; in ripemd160_init()
194 ctx->ripemd160_state[4] = 0xc3d2e1f0; in ripemd160_init()
197 ctx->magic = RIPEMD160_HASH_MAGIC; in ripemd160_init()
206 int ripemd160_update(ripemd160_context *ctx, const u8 *input, u32 ilen) in ripemd160_update() argument
208 const u8 *data_ptr = input; in ripemd160_update()
214 MUST_HAVE((input != NULL) || (ilen == 0), ret, err); in ripemd160_update()
224 left = (ctx->ripemd160_total & 0x3F); in ripemd160_update()
225 fill = (u16)(RIPEMD160_BLOCK_SIZE - left); in ripemd160_update()
227 ctx->ripemd160_total += ilen; in ripemd160_update()
231 ret = local_memcpy(ctx->ripemd160_buffer + left, data_ptr, fill); EG(ret, err); in ripemd160_update()
232 ret = ripemd160_process(ctx, ctx->ripemd160_buffer); EG(ret, err); in ripemd160_update()
234 remain_ilen -= fill; in ripemd160_update()
241 remain_ilen -= RIPEMD160_BLOCK_SIZE; in ripemd160_update()
245 ret = local_memcpy(ctx->ripemd160_buffer + left, data_ptr, remain_ilen); EG(ret, err); in ripemd160_update()
268 block_present = (ctx->ripemd160_total % RIPEMD160_BLOCK_SIZE); in ripemd160_final()
271 ret = local_memcpy(last_padded_block, ctx->ripemd160_buffer, in ripemd160_final()
279 if (block_present > (RIPEMD160_BLOCK_SIZE - 1 - sizeof(u64))) { in ripemd160_final()
281 PUT_UINT64_LE(8 * ctx->ripemd160_total, last_padded_block, in ripemd160_final()
282 (2 * RIPEMD160_BLOCK_SIZE) - sizeof(u64)); in ripemd160_final()
287 PUT_UINT64_LE(8 * ctx->ripemd160_total, last_padded_block, in ripemd160_final()
288 RIPEMD160_BLOCK_SIZE - sizeof(u64)); in ripemd160_final()
293 PUT_UINT32_LE(ctx->ripemd160_state[0], output, 0); in ripemd160_final()
294 PUT_UINT32_LE(ctx->ripemd160_state[1], output, 4); in ripemd160_final()
295 PUT_UINT32_LE(ctx->ripemd160_state[2], output, 8); in ripemd160_final()
296 PUT_UINT32_LE(ctx->ripemd160_state[3], output, 12); in ripemd160_final()
297 PUT_UINT32_LE(ctx->ripemd160_state[4], output, 16); in ripemd160_final()
300 ctx->magic = WORD(0); in ripemd160_final()
329 int ripemd160(const u8 *input, u32 ilen, u8 output[RIPEMD160_DIGEST_SIZE]) in ripemd160() argument
335 ret = ripemd160_update(&ctx, input, ilen); EG(ret, err); in ripemd160()