P
P
pewpew2012-11-16 08:27:01
PHP
pewpew, 2012-11-16 08:27:01

Implementation of the hash function GOST R 34.10-2001?

Good afternoon. I have a question on the topic of the day.
Now it has become popular to use EDS. In the work, this issue was usually bypassed, but now that's it. Necessary.
According to the terms of reference, we must implement the hash signature in accordance with GOST R 34.10-2001 .
There is a server on Linux and a development machine on Windows, Apache and PHP.
Accordingly, I see here either OpenSSL + PHP, or a ready-made implementation in PHP. The implementation of the GOST 28147-89 hash in PHP
was found on the network . After some digging, I found that OpenSSL 1.0.1c (the current version at the moment) implements all GOSTs. However, in practice, it turned out only to squeeze out only the GOST R 34.11-94 hash from it. The only implementation of obtaining a hash GOST R 34.10-2001
open source is written in C++ and doesn't really fit.
As a result, I need to somehow call all this economy from PHP like:
echo GOST2001('test');
And at the output have a hash
of 38060ff7776cfd8a461ec71a018e171d294c3c38cdd255955ffa816fe0af7c9e Does
anyone have any ideas?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sl_bug, 2012-11-16
@sl_bug

build and configure openssl as written here — cvs.openssl.org/fileview?f=openssl/engines/ccgost/README.gost&r=HEAD

$ openssl genpkey -algorithm gost2001 -pkeyopt paramset:A -out seckey.pem

$ cat seckey.pem 
-----BEGIN PRIVATE KEY-----
MEYCAQAwHAYGKoUDAgITMBIGByqFAwICIwEGByqFAwICHgEEIwIhAJ+m75X82GvN
kzuffIZaw8/L4VZdYtb1GHDekFQSFWWz
-----END PRIVATE KEY-----


I
IOFeed, 2016-01-28
@IOFeed

PHP has native support since version 5.6.0:
php.net/manual/en/function.hash-algos.php
For example:
echo hash('gost-crypto','test');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question