meta: rename to fx
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* and is in the public domain. */
|
||||
#include "hash.h"
|
||||
|
||||
#include <blue/core/hash.h>
|
||||
#include <fx/core/hash.h>
|
||||
#include <memory.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
@@ -19,7 +19,7 @@
|
||||
#define STEP(f, a, b, c, d, x, t, s) \
|
||||
(a += f(b, c, d) + x + t, a = ROTATE_LEFT(a, s), a += b)
|
||||
|
||||
void md5_init(struct b_hash_ctx *ctx)
|
||||
void md5_init(struct fx_hash_ctx *ctx)
|
||||
{
|
||||
ctx->ctx_state.md5.a = 0x67452301;
|
||||
ctx->ctx_state.md5.b = 0xefcdab89;
|
||||
@@ -30,7 +30,7 @@ void md5_init(struct b_hash_ctx *ctx)
|
||||
ctx->ctx_state.md5.count[1] = 0;
|
||||
}
|
||||
|
||||
uint8_t *md5_transform(struct b_hash_ctx *ctx, const void *data, uintmax_t size)
|
||||
uint8_t *md5_transform(struct fx_hash_ctx *ctx, const void *data, uintmax_t size)
|
||||
{
|
||||
uint8_t *ptr = (uint8_t *)data;
|
||||
uint32_t a, b, c, d, aa, bb, cc, dd;
|
||||
@@ -140,7 +140,7 @@ uint8_t *md5_transform(struct b_hash_ctx *ctx, const void *data, uintmax_t size)
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void md5_update(struct b_hash_ctx *ctx, const void *buffer, size_t buffer_size)
|
||||
void md5_update(struct fx_hash_ctx *ctx, const void *buffer, size_t buffer_size)
|
||||
{
|
||||
uint32_t saved_low = ctx->ctx_state.md5.count[0];
|
||||
uint32_t used;
|
||||
@@ -178,7 +178,7 @@ void md5_update(struct b_hash_ctx *ctx, const void *buffer, size_t buffer_size)
|
||||
memcpy(ctx->ctx_state.md5.input, buffer, buffer_size);
|
||||
}
|
||||
|
||||
void md5_finish(struct b_hash_ctx *ctx, void *out, size_t max)
|
||||
void md5_finish(struct fx_hash_ctx *ctx, void *out, size_t max)
|
||||
{
|
||||
uint32_t used = ctx->ctx_state.md5.count[0] & 0x3f;
|
||||
ctx->ctx_state.md5.input[used++] = 0x80;
|
||||
@@ -193,7 +193,7 @@ void md5_finish(struct b_hash_ctx *ctx, void *out, size_t max)
|
||||
|
||||
memset(&ctx->ctx_state.md5.input[used], 0, free - 8);
|
||||
|
||||
unsigned char digest[B_DIGEST_LENGTH_MD5];
|
||||
unsigned char digest[FX_DIGEST_LENGTH_MD5];
|
||||
|
||||
ctx->ctx_state.md5.count[0] <<= 3;
|
||||
ctx->ctx_state.md5.input[56] = (uint8_t)(ctx->ctx_state.md5.count[0]);
|
||||
@@ -228,10 +228,10 @@ void md5_finish(struct b_hash_ctx *ctx, void *out, size_t max)
|
||||
digest[14] = (uint8_t)(ctx->ctx_state.md5.d >> 16);
|
||||
digest[15] = (uint8_t)(ctx->ctx_state.md5.d >> 24);
|
||||
|
||||
memcpy(out, digest, b_min(size_t, sizeof digest, max));
|
||||
memcpy(out, digest, fx_min(size_t, sizeof digest, max));
|
||||
}
|
||||
|
||||
struct b_hash_function_ops z__b_md5_ops = {
|
||||
struct fx_hash_function_ops z__fx_md5_ops = {
|
||||
.hash_init = md5_init,
|
||||
.hash_update = md5_update,
|
||||
.hash_finish = md5_finish,
|
||||
|
||||
Reference in New Issue
Block a user