Skip to content

Commit

Permalink
Removes table of constants.
Browse files Browse the repository at this point in the history
  • Loading branch information
armfazh committed Mar 2, 2023
1 parent c2daa95 commit 9aa87e4
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions cipher/ascon/ascon.go
Expand Up @@ -255,18 +255,11 @@ func (a *Cipher) finalize(tag []byte) {
binary.BigEndian.PutUint64(tag[8:16], a.s[4]^a.key[2])
}

var roundConst = [12]uint64{0xf0, 0xe1, 0xd2, 0xc3, 0xb4, 0xa5, 0x96, 0x87, 0x78, 0x69, 0x5a, 0x4b}

func (a *Cipher) perm(n int) {
ri := 0
if n != permA {
ri = permA - n
}

x0, x1, x2, x3, x4 := a.s[0], a.s[1], a.s[2], a.s[3], a.s[4]
for i := 0; i < n; i++ {
for i := permA - n; i < permA; i++ {
// pC -- addition of constants
x2 ^= roundConst[ri+i]
x2 ^= uint64((0xF-i)<<4 | i)

// pS -- substitution layer
// Figure 6 from Spec [DHVV18,Dae18]
Expand Down

0 comments on commit 9aa87e4

Please sign in to comment.