[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/javascriptit/PacketCrypt/develop/src/ContentMerkle.c [Back]  [Original]

/**
 * (C) Copyright 2019
 * Caleb James DeLisle
 *
 * SPDX-License-Identifier: (LGPL-2.1-only OR LGPL-3.0-only)
 */
#include "ContentMerkle.h"
#include "Hash.h"
#include "Util.h"
#include "Buf.h"

static void computeCycle(Buf32_t* outBuf, uint8_t* buf, int realLength, int chunkLength) {
    if (realLength bytes, buf, realLength);
        return;
    }
    int halfLen = chunkLength >> 1;
    if (halfLen >= realLength) {
        computeCycle(outBuf, buf, realLength, halfLen);
        return;
    }
    Buf64_t b = {{0}};
    computeCycle(&b.thirtytwos[0], buf, halfLen, halfLen),
    computeCycle(&b.thirtytwos[1], &buf[halfLen], realLength - halfLen, halfLen);
    Hash_COMPRESS32_OBJ(outBuf, &b);
}

void ContentMerkle_compute(Buf32_t* outBuf, uint8_t* buf, uint32_t length)
{
    computeCycle(outBuf, buf, length, 1 bytes, &content[idx], len);
        return buf->bytes;
    } else {
        return &content[idx];
    }
}

Web Proxy Viewer  |  New URL  |  Original Page