Giter Club home page Giter Club logo

Comments (11)

martinlindhe avatar martinlindhe commented on June 15, 2024

Might be due to some confusion from my part when I added this hash.

GOST is not a single algorithm and should probably be named better.

There are (at least) the following GOST hash functions:

  • GOST R 34.11-94 this the older gost hash from 1994 and the one that hasher calls gost, it should be given a better name, maybe gost-94 ? Note: Standard does not define how digest output must be presented – that is why there are incompatible implementations, that output digest as either little-endian or big-endian value.

  • GOST R 34.11-2012 (Streebog) this is the more current "gost hash" from 2012, and is not currently implemented in hasher

I believe what rhash calls "gost-cryptopro" is GOST R 34.11-2012 (not currently supported in hasher).

Anyway, there are a couple of test hashes for GOST R 34.11-94 listed at https://en.wikipedia.org/wiki/GOST_(hash_function)#GOST_hash_test_vectors

I tested

echo -n "message digest" | hasher gost
4d9a88a416de2fdb72de483f27652b5869243dec59be0cb6992c8fb1ec3444ad  -

And if you look at the reference hash on wikipedia for this string, you'll find ad4434ecb18f2c99b60cbe59ec3d2469582b65273f48de72db2fde16a4889a4d, which is the same hash, only in reversed endian. As noted above the specification does not define a endianness, thus conflicting implementations.

I will update hasher and rename gost to gost-94, improve the README and also look into adding GOST R 34.11-2012.

I'll keep this issue open tracking this progress.

from gohash.

martinlindhe avatar martinlindhe commented on June 15, 2024

I also now see that in http://git.cypherpunks.ru/cgit.cgi/gogost.git/tree/NEWS for 2.0: " 34.11-94's digest is reversed. Now it is compatible with TC26's HMAC and PBKDF2 test vectors"

My old fork is older than 2.0, thus the reversed hash here.
I will vendor dependencies and delete my old fork. gogost also has support for "gost-2012" aka cryptopro so it will be easy to add.

from gohash.

grylem avatar grylem commented on June 15, 2024

hasher and rhash use GOST 34.11.94
https://github.com/rhash/RHash

from gohash.

martinlindhe avatar martinlindhe commented on June 15, 2024

@grylem indeed, I now notice the checksums are the same, just different endian (bytes are reversed, each byte corresponds to two hex characters)

from your first post:

6ebdd006a02cee408ab52c60408ad1b3c7fd5dfe9cfd8c2bd15bf1fb6d2a5c49

and

495c2a6dfbf15bd12b8cfd9cfe5dfdc7b3d18a40602cb58a40ee2ca006d0bd6e

EDIT:

verified this:

$ rhash -G --gost-reverse README.md
6ebdd006a02cee408ab52c60408ad1b3c7fd5dfe9cfd8c2bd15bf1fb6d2a5c49  README.md
$ hasher -i README.md gost
6ebdd006a02cee408ab52c60408ad1b3c7fd5dfe9cfd8c2bd15bf1fb6d2a5c49  README.md

from gohash.

martinlindhe avatar martinlindhe commented on June 15, 2024

Hello

I have finished fixing this up, thanks for reporting it!

  • The gost hash is now called gost94 for clarity. For backwards compatibility, gost resolves to gost94.
  • The gogost library used has been updated and vendored, resulting in reversed order of the produced hash by default. To get the old behavior, you can invoke hasher gost94 --reverse-bytes.
  • The GOST R 34.11-94 CryptoPro variant has been added as gost94-cryptopro.
  • The GOST R 34.11-2012 hashes streebog-256 and streebog-512 have been added.

To update to the latest versions of the command line tools, simply run

go get -u github.com/martinlindhe/gohash/...

from gohash.

sergeevabc avatar sergeevabc commented on June 15, 2024

gohash.exe streebog-512 -i 5G.random led to OS freezing.
Also be sure to have a peek at Streebog’s SSE2 optimized version.

from gohash.

martinlindhe avatar martinlindhe commented on June 15, 2024

gohash.exe streebog-512 -i 5G.random led to OS freezing.

What executable is gohash.exe ? The one to use should be named hasher / hasher.exe, which is distributed from https://github.com/martinlindhe/gohash/releases and documented at https://github.com/martinlindhe/gohash/tree/master/cmd/hasher

I also cannot reproduce OS freeze (tried with 5 and 10 gb of random data).

Also be sure to have a peek at Streebog’s SSE2 optimized version.

Gohash currently uses the golang implementation from http://git.cypherpunks.ru/cgit.cgi/gogost.git
maybe they are interested in the streebog code.

from gohash.

martinlindhe avatar martinlindhe commented on June 15, 2024

@sergeevabc maybe you are using a pretty old version of gohash? I seem to recall the binary was called simply gohash around 2016-2017 before being splitted into multiple commands (hasher, coder, findhash).

Could you try with a current version?

from gohash.

sergeevabc avatar sergeevabc commented on June 15, 2024

Ah, gohash.exe here is a renamed hasher.exe (because the original sounds too generic to my taste). I used version 0.2.5 according to its checksum (by the way, not showing version number upon launch or at least with --v/--version switch seems an odd choice for CLI util).

Running it again now… Damn, it has been working for 10 minutes already (on 5G file), which is not OK (since it takes 1 minute to process this file with RHash.exe, Digest.exe, or Streebog.exe).

More stats: SHA512 and Skein512-512 took 43 sec, Whirlpool took 198 sec, so maybe there is something wrong with Streebog’s implementation.

from gohash.

martinlindhe avatar martinlindhe commented on June 15, 2024

The primary motivation for this tool was portability and correctness. Speed has not been looked at much. Patches are welcome!

I'm having a look at the gost code now to see if i can speed anything up without too much effort.

from gohash.

martinlindhe avatar martinlindhe commented on June 15, 2024

Hi @sergeevabc, I opened a new issue about the bad performance you brought up here, lets continue tracking the status in #4

from gohash.

Related Issues (8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.