Skip to content

GHASH multiplication result #202

Closed
Closed
@makavity

Description

@makavity

Hello. I have two words:
u: 34904055 11BE3297 1343724C 5AB793E9
v: 22481783 8761A9D6 E3EC9689 110FB0F3

u * v is defined: 𝑤(𝑥) = 𝑢(𝑥)𝑣(𝑥) mod 𝑥 ^ 128 + 𝑥 ^ 7 + 𝑥 ^ 2 + 𝑥 + 1

u * v should be: 0001D107 FC67DE40 04DC2C80 3DFD95C3

As i suggest, code should be like this:

let a = hex!("34904055 11BE3297 1343724C 5AB793E9");
let mut b = hex!("22481783 8761A9D6 E3EC9689 110FB0F3");
b.reverse();
let a_block = Block::from(a);
let b_block = Block::from(b);
let b_block = crate::mulx(&b_block);

let u = U64x2::from(&a_block);
let v = U64x2::from(&b_block);
let w = u * v;

But result is like: [43, EF, 88, F0, CA, C0, 21, F9, D1, BD, 33, 94, A0, E4, C0, DE]

Also, tried to reverse output bytes, but no luck with that. Any ideas how to deal with that?
Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions