scarv / xcrypto

XCrypto: a cryptographic ISE for RISC-V
MIT License
90 stars 10 forks source link

Instruction Proposal: xc.sbox.4 #52

Closed ben-marshall closed 5 years ago

ben-marshall commented 5 years ago

An instruction implementing an in-place 4-bit sbox

The concatenation of crs1 and crs2 describes the sbox, where the i'th nibble corresponds to sbox[i].

xc.sbox.4 crd, crs1, crs2
    let t = crs1 || crs2
    for i in 0..15
        let sbox[i] = t[4*i+3 :4*i]
    for i in 0..15
        let crd[4*i+3: 4*i] = sbox[crd[i]]
ben-marshall commented 5 years ago

Usage: PRINCE, PRESENT, others?

ben-marshall commented 5 years ago

Eventually merged as xc.lut instruction.