kokke / kokke/tiny-AES-c

Multiply function could be 20% faster and smaller

Open
#194 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

All of the [constants](https://github.com/kokke/tiny-AES-c/blob/12e7744b4919e9d55de75b7ab566326a1c8e7a67/aes.c#L361-L364) needed by AES for the inversion of the MixColumns function fit in 4 bits, but both the function and macro versions of the `Multiply()` function support 5 bits. The size and performance of this could be improved by removing the case when [`((y >>4) & 1)` is set](https://github.com/kokke/tiny-AES-c/blob/12e7744b4919e9d55de75b7ab566326a1c8e7a67/aes.c#L326), since this can never happen with the constants used.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in aes.c at the Multiply() implementation and macro, along with the AES constants at lines 361-364. Confirm that the listed constants never set bit 4 of y. Done means both versions no longer handle that unreachable case while AES behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cryptography
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.