Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions threefish1024.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ func New1024(key, tweak []byte) (cipher.Block, error) {
// Load and extend the key
k := new([numWords1024 + 1]uint64)
k[numWords1024] = c240
for i := 0; i < numWords1024; i++ {
for i := range numWords1024 {
k[i] = binary.LittleEndian.Uint64(key[i*8 : (i+1)*8])
k[numWords1024] ^= k[i]
}

// Calculate the key schedule
for s := 0; s <= numRounds1024/4; s++ {
for i := 0; i < numWords1024; i++ {
for i := range numWords1024 {
c.ks[s][i] = k[(s+i)%(numWords1024+1)]
switch i {
case numWords1024 - 3:
Expand Down
4 changes: 2 additions & 2 deletions threefish256.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ func New256(key, tweak []byte) (cipher.Block, error) {
// Load and extend key
k := new([numWords256 + 1]uint64)
k[numWords256] = c240
for i := 0; i < numWords256; i++ {
for i := range numWords256 {
k[i] = binary.LittleEndian.Uint64(key[i*8 : (i+1)*8])
k[numWords256] ^= k[i]
}

// Calculate the key schedule
for s := 0; s <= numRounds256/4; s++ {
for i := 0; i < numWords256; i++ {
for i := range numWords256 {
c.ks[s][i] = k[(s+i)%(numWords256+1)]
switch i {
case numWords256 - 3:
Expand Down
4 changes: 2 additions & 2 deletions threefish512.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ func New512(key, tweak []byte) (cipher.Block, error) {
// Load and extend the key
k := new([numWords512 + 1]uint64)
k[numWords512] = c240
for i := 0; i < numWords512; i++ {
for i := range numWords512 {
k[i] = binary.LittleEndian.Uint64(key[i*8 : (i+1)*8])
k[numWords512] ^= k[i]
}

// Calculate the key schedule
for s := 0; s <= numRounds512/4; s++ {
for i := 0; i < numWords512; i++ {
for i := range numWords512 {
c.ks[s][i] = k[(s+i)%(numWords512+1)]
switch i {
case numWords512 - 3:
Expand Down