Function sha::sha512::ops::digest_round_x4 [-] [+] [src]

pub fn digest_round_x4(state: &mut [u64; 8], k: [u64; 4], w: [u64; 4])

There are no plans for hardware implementations at this time, but this function can be easily implemented with some kind of SIMD assistance.

{
    // this is to illustrate the data order
    let ae = u64x2(a, e);
    let bf = u64x2(b, f);
    let cg = u64x2(c, g);
    let dh = u64x2(d, h);

    // this is the core expression
    dh = sha512rnd(dh, ae, bf, cg, work[0]);
    cg = sha512rnd(cg, dh, ae, bf, work[1]);
    bf = sha512rnd(bf, cg, dh, ae, work[2]);
    ae = sha512rnd(ae, bf, cg, dh, work[3]);

    a = ae.0;
    b = bf.0;
    c = cg.0;
    d = dh.0;
    e = ae.1;
    f = bf.1;
    g = cg.1;
    h = dh.1;
}