X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fcypherpunks.ru%2Fgogost%2Fmgm%2Fmode.go;h=20f77c71fd580ddafad97b4aa1a76fd0957379a2;hb=9be6f384bae8ebeabc129ede9f8a597de12835d3;hp=2781cbba2d3554e9593c8caebfa04509f34a7ac1;hpb=610860b0f192687574911142f508e71f6baacb50;p=gogost.git diff --git a/src/cypherpunks.ru/gogost/mgm/mode.go b/src/cypherpunks.ru/gogost/mgm/mode.go index 2781cbb..20f77c7 100644 --- a/src/cypherpunks.ru/gogost/mgm/mode.go +++ b/src/cypherpunks.ru/gogost/mgm/mode.go @@ -101,10 +101,11 @@ func (mgm *MGM) Overhead() int { } func incr(data []byte) { - if len(data) == 4 { - binary.BigEndian.PutUint32(data, binary.BigEndian.Uint32(data)+1) - } else { - binary.BigEndian.PutUint64(data, binary.BigEndian.Uint64(data)+1) + for i := len(data) - 1; i >= 0; i-- { + data[i]++ + if data[i] != 0 { + return + } } }