]> Cypherpunks.ru repositories - gogost.git/blobdiff - src/cypherpunks.ru/gogost/gost341194/hash.go
Sbox names comply with OIDs
[gogost.git] / src / cypherpunks.ru / gogost / gost341194 / hash.go
index ebbbca5460708d1bd07ee372dfe43b7558f44260..71cbb87f50e727274659d20a86b2c2b43e146ff7 100644 (file)
@@ -1,5 +1,5 @@
 // GoGOST -- Pure Go GOST cryptographic functions library
-// Copyright (C) 2015-2016 Sergey Matveev <stargrave@stargrave.org>
+// Copyright (C) 2015-2019 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
@@ -31,7 +31,7 @@ const (
 )
 
 var (
-       SboxDefault *gost28147.Sbox = &gost28147.GostR3411_94_TestParamSet
+       SboxDefault *gost28147.Sbox = &gost28147.SboxIdGostR341194TestParamSet
 
        c2 [BlockSize]byte = [BlockSize]byte{
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -79,7 +79,7 @@ func (h *Hash) Reset() {
                0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
        }
        h.chk = big.NewInt(0)
-       h.buf = nil
+       h.buf = h.buf[:0]
 }
 
 func (h *Hash) BlockSize() int {
@@ -266,5 +266,6 @@ func (h *Hash) Sum(in []byte) []byte {
        chkBytes := chk.Bytes()
        copy(block[BlockSize-len(chkBytes):], chkBytes)
        hsh = h.step(hsh, *block)
+       blockReverse(hsh[:], hsh[:])
        return append(in, hsh[:]...)
 }