SHA256 How to get digest value in `unsigned char` format?
#5
Thank you very much for your help.

In hashcat file: inc_common.cl, I find `DECLSPEC u8 v8a_from_v32_S (const u32 v32)` function.
From what I understand (I'm starting in OpenCL), it is also possible to do :

Code:
    const u32 r0 = ctx0.h[0];
    const u32 r1 = ctx0.h[1];
    const u32 r2 = ctx0.h[2];
    const u32 r3 = ctx0.h[3];
    
    const u32 digest32[4] = { r0, r1, r2, r3 };
    u8 digest8[16];
    vconv32_t v;

    for (unsigned int i = 0; i < 4; i++)
    {
        v.v32 = digest32[i];
        digest8[i * 4] = v.v8a;
        digest8[i * 4 + 1] = v.v8b;
        digest8[i * 4 + 2] = v.v8c;
        digest8[i * 4 + 3] = v.v8d;
    }

What do you mean by "the output of sha256 is 32 bytes, not 16 bytes: I see that you are using 16 bytes output, but sha256 outputs 32 raw bytes"?  With OpenCL u32 is an unsigned int ?
Reply


Messages In This Thread
RE: SHA256 How to get digest value in `unsigned char` format? - by LeMoussel - 03-31-2019, 06:12 PM