Skip to content

Commit

Permalink
Merge pull request #17 from moov-io/fix-the-bug
Browse files Browse the repository at this point in the history
use slice with proper length (a multiple of a block size)
  • Loading branch information
alovak authored Mar 4, 2024
2 parents 6d7d067 + 23fdca4 commit f6a11f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/des/des.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ func GenerateMac(currentKey []byte, plainText, action string) ([]byte, error) {
initialVector := make([]byte, desBlockLen)
leftCipher, _ := encryption.NewDesECB(leftKey)
for partNum := 0; partNum < repeatCnt; partNum++ {
macPart := plainTextBytes[partNum*desBlockLen : (partNum+1)*desBlockLen]
macPart := serializePlaintext[partNum*desBlockLen : (partNum+1)*desBlockLen]
for in := range initialVector {
initialVector[in] = initialVector[in] ^ macPart[in]
}
Expand Down

0 comments on commit f6a11f5

Please sign in to comment.