]> Cypherpunks.ru repositories - gogost.git/blobdiff - mgm/mul.go
Separate GF^64 and GF^128 multiplier implementations
[gogost.git] / mgm / mul.go
diff --git a/mgm/mul.go b/mgm/mul.go
deleted file mode 100644 (file)
index 8fec466..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-// GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2021 Sergey Matveev <stargrave@stargrave.org>
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, version 3 of the License.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-package mgm
-
-func (mgm *MGM) mul(xBuf, yBuf []byte) []byte {
-       mgm.x.SetBytes(xBuf)
-       mgm.y.SetBytes(yBuf)
-       mgm.z.SetInt64(0)
-       for mgm.y.BitLen() != 0 {
-               if mgm.y.Bit(0) == 1 {
-                       mgm.z.Xor(mgm.z, mgm.x)
-               }
-               if mgm.x.Bit(mgm.maxBit) == 1 {
-                       mgm.x.SetBit(mgm.x, mgm.maxBit, 0)
-                       mgm.x.Lsh(mgm.x, 1)
-                       mgm.x.Xor(mgm.x, mgm.r)
-               } else {
-                       mgm.x.Lsh(mgm.x, 1)
-               }
-               mgm.y.Rsh(mgm.y, 1)
-       }
-       zBytes := mgm.z.Bytes()
-       rem := len(xBuf) - len(zBytes)
-       for i := 0; i < rem; i++ {
-               mgm.mulBuf[i] = 0
-       }
-       copy(mgm.mulBuf[rem:], zBytes)
-       return mgm.mulBuf
-}