refactor: externalise gfmul to make it more accessible and semantic support
This commit is contained in:
parent
31050ea696
commit
f4c49a9137
5 changed files with 96 additions and 64 deletions
|
|
@ -83,7 +83,7 @@ pub fn xex_encrypt(mut key: Vec<u8>, tweak: &Vec<u8>, input: &Vec<u8>) -> Result
|
|||
let cypher_block_intermediate = sea_128_encrypt(&key, &plaintext_intermediate)?;
|
||||
let mut cypher_block = xor_bytes(&tweak_block.0, cypher_block_intermediate)?;
|
||||
output.append(cypher_block.as_mut());
|
||||
tweak_block.left_shift_reduce();
|
||||
tweak_block.left_shift_reduce("xex");
|
||||
}
|
||||
|
||||
Ok(output)
|
||||
|
|
@ -116,7 +116,7 @@ pub fn xex_decrypt(mut key: Vec<u8>, tweak: &Vec<u8>, input: &Vec<u8>) -> Result
|
|||
let plaintext_block_intermediate = sea_128_decrypt(&key, &cyphertext_intermediate)?;
|
||||
let mut cypher_block = xor_bytes(&tweak_block.0, plaintext_block_intermediate)?;
|
||||
output.append(cypher_block.as_mut());
|
||||
tweak_block.left_shift_reduce();
|
||||
tweak_block.left_shift_reduce("xex");
|
||||
}
|
||||
|
||||
Ok(output)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue