Commit:    8ca43527e8b7e076779560f1472518bd1fe4d6ca
Author:    Manuel Mausz <man...@mausz.at>         Thu, 5 Sep 2013 01:04:25 +0200
Parents:   6ece5503942a1d8c4a78504161f9466e9e14fed2
Branches:  master

Link:       
http://git.php.net/?p=php-src.git;a=commitdiff;h=8ca43527e8b7e076779560f1472518bd1fe4d6ca

Log:
Add support for CryptoPro S-box for GOST

This adds a new hash identifier "gost-crypto" which uses the CryptoPro
S-box tables as specified by RFC 4357, section 11.2.

Changed paths:
  M  ext/hash/hash.c
  M  ext/hash/hash_gost.c
  M  ext/hash/php_hash.h
  M  ext/hash/php_hash_gost.h
  M  ext/hash/php_hash_gost_tables.h
  M  ext/hash/tests/gost.phpt

diff --git a/ext/hash/hash.c b/ext/hash/hash.c
index 1172214..87f19c5 100644
--- a/ext/hash/hash.c
+++ b/ext/hash/hash.c
@@ -986,6 +986,7 @@ PHP_MINIT_FUNCTION(hash)
        php_hash_register_algo("snefru",                &php_hash_snefru_ops);
        php_hash_register_algo("snefru256",             &php_hash_snefru_ops);
        php_hash_register_algo("gost",                  &php_hash_gost_ops);
+       php_hash_register_algo("gost-crypto",           
&php_hash_gost_crypto_ops);
        php_hash_register_algo("adler32",               &php_hash_adler32_ops);
        php_hash_register_algo("crc32",                 &php_hash_crc32_ops);
        php_hash_register_algo("crc32b",                &php_hash_crc32b_ops);
diff --git a/ext/hash/hash_gost.c b/ext/hash/hash_gost.c
index 3961c4f..7546c8d 100644
--- a/ext/hash/hash_gost.c
+++ b/ext/hash/hash_gost.c
@@ -27,7 +27,7 @@
  * derived from gost_compress() by Markku-Juhani Saarinen <m...@ssh.fi>
  */
 
-#define round(k1, k2) \
+#define round(tables, k1, k2) \
        t = (k1) + r; \
        l ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \
                tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24]; \
@@ -35,25 +35,25 @@
        r ^= tables[0][t & 0xff] ^ tables[1][(t >> 8) & 0xff] ^ \
                tables[2][(t >> 16) & 0xff] ^ tables[3][t >> 24];
 
-#define R(key, h, i, t, l, r) \
+#define R(tables, key, h, i, t, l, r) \
        r = h[i]; \
        l = h[i + 1]; \
-       round(key[0], key[1]) \
-       round(key[2], key[3]) \
-       round(key[4], key[5]) \
-       round(key[6], key[7]) \
-       round(key[0], key[1]) \
-       round(key[2], key[3]) \
-       round(key[4], key[5]) \
-       round(key[6], key[7]) \
-       round(key[0], key[1]) \
-       round(key[2], key[3]) \
-       round(key[4], key[5]) \
-       round(key[6], key[7]) \
-       round(key[7], key[6]) \
-       round(key[5], key[4]) \
-       round(key[3], key[2]) \
-       round(key[1], key[0]) \
+       round(tables, key[0], key[1]) \
+       round(tables, key[2], key[3]) \
+       round(tables, key[4], key[5]) \
+       round(tables, key[6], key[7]) \
+       round(tables, key[0], key[1]) \
+       round(tables, key[2], key[3]) \
+       round(tables, key[4], key[5]) \
+       round(tables, key[6], key[7]) \
+       round(tables, key[0], key[1]) \
+       round(tables, key[2], key[3]) \
+       round(tables, key[4], key[5]) \
+       round(tables, key[6], key[7]) \
+       round(tables, key[7], key[6]) \
+       round(tables, key[5], key[4]) \
+       round(tables, key[3], key[2]) \
+       round(tables, key[1], key[0]) \
        t = r; \
        r = l; \
        l = t; \
@@ -194,10 +194,10 @@
                (v[3] >> 16) ^ v[3] ^ (v[4] << 16) ^ v[4] ^ (v[5] >> 16) ^ v[5] 
^ \
                (v[6] << 16) ^ (v[6] >> 16) ^ (v[7] << 16) ^ v[7];
 
-#define PASS \
+#define PASS(tables) \
        X(w, u, v); \
        P(key, w); \
-       R(key, h, i, t, l, r); \
+       R((tables), key, h, i, t, l, r); \
        S(s, l, r); \
        if (i != 6) { \
                A(u, l, r); \
@@ -207,16 +207,16 @@
                AA(v, l, r); \
        }
 
-static inline void Gost(php_hash_uint32 state[8], php_hash_uint32 data[8])
+static inline void Gost(PHP_GOST_CTX *context, php_hash_uint32 data[8])
 {
        int i;
-       php_hash_uint32 l, r, t, key[8], u[8], v[8], w[8], s[8], *h = state, *m 
= data;
+       php_hash_uint32 l, r, t, key[8], u[8], v[8], w[8], s[8], *h = 
context->state, *m = data;
        
-       memcpy(u, state, sizeof(u));
+       memcpy(u, context->state, sizeof(u));
        memcpy(v, data, sizeof(v));
        
        for (i = 0; i < 8; i += 2) {
-               PASS;
+               PASS(*context->tables);
        }
        SHIFT12(u, m, s);
        SHIFT16(h, v, u);
@@ -237,12 +237,19 @@ static inline void GostTransform(PHP_GOST_CTX *context, 
const unsigned char inpu
                temp = ((context->state[i + 8] < data[i]) || (context->state[i 
+ 8] < save)) ? 1 : 0;     
        }
        
-       Gost(context->state, data);
+       Gost(context, data);
 }
 
 PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *context)
 {
        memset(context, 0, sizeof(*context));
+    context->tables = &tables_test;
+}
+
+PHP_HASH_API void PHP_GOSTInitCrypto(PHP_GOST_CTX *context)
+{
+    PHP_GOSTInit(context);
+    context->tables = &tables_crypto;
 }
 
 static const php_hash_uint32 MAX32 = 0xffffffffLU;
@@ -288,9 +295,9 @@ PHP_HASH_API void PHP_GOSTFinal(unsigned char digest[32], 
PHP_GOST_CTX *context)
        }
        
        memcpy(l, context->count, sizeof(context->count));
-       Gost(context->state, l);
+       Gost(context, l);
        memcpy(l, &context->state[8], sizeof(l));
-       Gost(context->state, l);
+       Gost(context, l);
        
        for (i = 0, j = 0; j < 32; i++, j += 4) {
                digest[j] = (unsigned char) (context->state[i] & 0xff);
@@ -312,6 +319,16 @@ const php_hash_ops php_hash_gost_ops = {
        sizeof(PHP_GOST_CTX)
 };
 
+const php_hash_ops php_hash_gost_crypto_ops = {
+       (php_hash_init_func_t) PHP_GOSTInitCrypto,
+       (php_hash_update_func_t) PHP_GOSTUpdate,
+       (php_hash_final_func_t) PHP_GOSTFinal,
+       (php_hash_copy_func_t) php_hash_copy,
+       32,
+       32,
+       sizeof(PHP_GOST_CTX)
+};
+
 /*
  * Local variables:
  * tab-width: 4
diff --git a/ext/hash/php_hash.h b/ext/hash/php_hash.h
index 3f5e7ce..e925722 100644
--- a/ext/hash/php_hash.h
+++ b/ext/hash/php_hash.h
@@ -80,6 +80,7 @@ extern const php_hash_ops php_hash_4tiger160_ops;
 extern const php_hash_ops php_hash_4tiger192_ops;
 extern const php_hash_ops php_hash_snefru_ops;
 extern const php_hash_ops php_hash_gost_ops;
+extern const php_hash_ops php_hash_gost_crypto_ops;
 extern const php_hash_ops php_hash_adler32_ops;
 extern const php_hash_ops php_hash_crc32_ops;
 extern const php_hash_ops php_hash_crc32b_ops;
diff --git a/ext/hash/php_hash_gost.h b/ext/hash/php_hash_gost.h
index 6a4af31..a9c1375 100644
--- a/ext/hash/php_hash_gost.h
+++ b/ext/hash/php_hash_gost.h
@@ -29,6 +29,7 @@ typedef struct {
        php_hash_uint32 count[2];
        unsigned char length;
        unsigned char buffer[32];
+       const php_hash_uint32 (*tables)[4][256];
 } PHP_GOST_CTX;
 
 PHP_HASH_API void PHP_GOSTInit(PHP_GOST_CTX *);
diff --git a/ext/hash/php_hash_gost_tables.h b/ext/hash/php_hash_gost_tables.h
index 5d05e59..a00d8b7 100644
--- a/ext/hash/php_hash_gost_tables.h
+++ b/ext/hash/php_hash_gost_tables.h
@@ -1,4 +1,4 @@
-static const php_hash_uint32 tables[4][256] = {
+static const php_hash_uint32 tables_test[4][256] = {
        { /* table 1 */
                0x00072000LU, 0x00075000LU, 0x00074800LU, 0x00071000LU, 
0x00076800LU, 0x00074000LU, 0x00070000LU, 0x00077000LU, 
                0x00073000LU, 0x00075800LU, 0x00070800LU, 0x00076000LU, 
0x00073800LU, 0x00077800LU, 0x00072800LU, 0x00071800LU, 
@@ -136,3 +136,142 @@ static const php_hash_uint32 tables[4][256] = {
                0x00000600LU, 0x00000650LU, 0x00000670LU, 0x00000638LU, 
0x00000630LU, 0x00000640LU, 0x00000610LU, 0x00000660LU, 
        },
 };
+
+static const php_hash_uint32 tables_crypto[4][256] = {
+       { /* table 1 */
+               0x0002d000LU, 0x0002a000LU, 0x0002a800LU, 0x0002b000LU, 
0x0002c000LU, 0x00028800LU, 0x00029800LU, 0x0002b800LU, 
+               0x0002e800LU, 0x0002e000LU, 0x0002f000LU, 0x00028000LU, 
0x0002c800LU, 0x00029000LU, 0x0002d800LU, 0x0002f800LU, 
+               0x0007d000LU, 0x0007a000LU, 0x0007a800LU, 0x0007b000LU, 
0x0007c000LU, 0x00078800LU, 0x00079800LU, 0x0007b800LU, 
+               0x0007e800LU, 0x0007e000LU, 0x0007f000LU, 0x00078000LU, 
0x0007c800LU, 0x00079000LU, 0x0007d800LU, 0x0007f800LU, 
+               0x00025000LU, 0x00022000LU, 0x00022800LU, 0x00023000LU, 
0x00024000LU, 0x00020800LU, 0x00021800LU, 0x00023800LU, 
+               0x00026800LU, 0x00026000LU, 0x00027000LU, 0x00020000LU, 
0x00024800LU, 0x00021000LU, 0x00025800LU, 0x00027800LU, 
+               0x00005000LU, 0x00002000LU, 0x00002800LU, 0x00003000LU, 
0x00004000LU, 0x00000800LU, 0x00001800LU, 0x00003800LU, 
+               0x00006800LU, 0x00006000LU, 0x00007000LU, 0x00000000LU, 
0x00004800LU, 0x00001000LU, 0x00005800LU, 0x00007800LU, 
+               0x00015000LU, 0x00012000LU, 0x00012800LU, 0x00013000LU, 
0x00014000LU, 0x00010800LU, 0x00011800LU, 0x00013800LU, 
+               0x00016800LU, 0x00016000LU, 0x00017000LU, 0x00010000LU, 
0x00014800LU, 0x00011000LU, 0x00015800LU, 0x00017800LU, 
+               0x0006d000LU, 0x0006a000LU, 0x0006a800LU, 0x0006b000LU, 
0x0006c000LU, 0x00068800LU, 0x00069800LU, 0x0006b800LU, 
+               0x0006e800LU, 0x0006e000LU, 0x0006f000LU, 0x00068000LU, 
0x0006c800LU, 0x00069000LU, 0x0006d800LU, 0x0006f800LU, 
+               0x0005d000LU, 0x0005a000LU, 0x0005a800LU, 0x0005b000LU, 
0x0005c000LU, 0x00058800LU, 0x00059800LU, 0x0005b800LU, 
+               0x0005e800LU, 0x0005e000LU, 0x0005f000LU, 0x00058000LU, 
0x0005c800LU, 0x00059000LU, 0x0005d800LU, 0x0005f800LU, 
+               0x0004d000LU, 0x0004a000LU, 0x0004a800LU, 0x0004b000LU, 
0x0004c000LU, 0x00048800LU, 0x00049800LU, 0x0004b800LU, 
+               0x0004e800LU, 0x0004e000LU, 0x0004f000LU, 0x00048000LU, 
0x0004c800LU, 0x00049000LU, 0x0004d800LU, 0x0004f800LU, 
+               0x0000d000LU, 0x0000a000LU, 0x0000a800LU, 0x0000b000LU, 
0x0000c000LU, 0x00008800LU, 0x00009800LU, 0x0000b800LU, 
+               0x0000e800LU, 0x0000e000LU, 0x0000f000LU, 0x00008000LU, 
0x0000c800LU, 0x00009000LU, 0x0000d800LU, 0x0000f800LU, 
+               0x0003d000LU, 0x0003a000LU, 0x0003a800LU, 0x0003b000LU, 
0x0003c000LU, 0x00038800LU, 0x00039800LU, 0x0003b800LU, 
+               0x0003e800LU, 0x0003e000LU, 0x0003f000LU, 0x00038000LU, 
0x0003c800LU, 0x00039000LU, 0x0003d800LU, 0x0003f800LU, 
+               0x00035000LU, 0x00032000LU, 0x00032800LU, 0x00033000LU, 
0x00034000LU, 0x00030800LU, 0x00031800LU, 0x00033800LU, 
+               0x00036800LU, 0x00036000LU, 0x00037000LU, 0x00030000LU, 
0x00034800LU, 0x00031000LU, 0x00035800LU, 0x00037800LU, 
+               0x0001d000LU, 0x0001a000LU, 0x0001a800LU, 0x0001b000LU, 
0x0001c000LU, 0x00018800LU, 0x00019800LU, 0x0001b800LU, 
+               0x0001e800LU, 0x0001e000LU, 0x0001f000LU, 0x00018000LU, 
0x0001c800LU, 0x00019000LU, 0x0001d800LU, 0x0001f800LU, 
+               0x00065000LU, 0x00062000LU, 0x00062800LU, 0x00063000LU, 
0x00064000LU, 0x00060800LU, 0x00061800LU, 0x00063800LU, 
+               0x00066800LU, 0x00066000LU, 0x00067000LU, 0x00060000LU, 
0x00064800LU, 0x00061000LU, 0x00065800LU, 0x00067800LU, 
+               0x00075000LU, 0x00072000LU, 0x00072800LU, 0x00073000LU, 
0x00074000LU, 0x00070800LU, 0x00071800LU, 0x00073800LU, 
+               0x00076800LU, 0x00076000LU, 0x00077000LU, 0x00070000LU, 
0x00074800LU, 0x00071000LU, 0x00075800LU, 0x00077800LU, 
+               0x00055000LU, 0x00052000LU, 0x00052800LU, 0x00053000LU, 
0x00054000LU, 0x00050800LU, 0x00051800LU, 0x00053800LU, 
+               0x00056800LU, 0x00056000LU, 0x00057000LU, 0x00050000LU, 
0x00054800LU, 0x00051000LU, 0x00055800LU, 0x00057800LU, 
+               0x00045000LU, 0x00042000LU, 0x00042800LU, 0x00043000LU, 
0x00044000LU, 0x00040800LU, 0x00041800LU, 0x00043800LU, 
+               0x00046800LU, 0x00046000LU, 0x00047000LU, 0x00040000LU, 
0x00044800LU, 0x00041000LU, 0x00045800LU, 0x00047800LU, 
+       },
+       { /* table 2 */
+               0x02380000LU, 0x02780000LU, 0x02600000LU, 0x02700000LU, 
0x02480000LU, 0x02200000LU, 0x02080000LU, 0x02000000LU, 
+               0x02180000LU, 0x02580000LU, 0x02280000LU, 0x02100000LU, 
0x02300000LU, 0x02500000LU, 0x02400000LU, 0x02680000LU, 
+               0x05380000LU, 0x05780000LU, 0x05600000LU, 0x05700000LU, 
0x05480000LU, 0x05200000LU, 0x05080000LU, 0x05000000LU, 
+               0x05180000LU, 0x05580000LU, 0x05280000LU, 0x05100000LU, 
0x05300000LU, 0x05500000LU, 0x05400000LU, 0x05680000LU, 
+               0x03b80000LU, 0x03f80000LU, 0x03e00000LU, 0x03f00000LU, 
0x03c80000LU, 0x03a00000LU, 0x03880000LU, 0x03800000LU, 
+               0x03980000LU, 0x03d80000LU, 0x03a80000LU, 0x03900000LU, 
0x03b00000LU, 0x03d00000LU, 0x03c00000LU, 0x03e80000LU, 
+               0x06380000LU, 0x06780000LU, 0x06600000LU, 0x06700000LU, 
0x06480000LU, 0x06200000LU, 0x06080000LU, 0x06000000LU, 
+               0x06180000LU, 0x06580000LU, 0x06280000LU, 0x06100000LU, 
0x06300000LU, 0x06500000LU, 0x06400000LU, 0x06680000LU, 
+               0x00380000LU, 0x00780000LU, 0x00600000LU, 0x00700000LU, 
0x00480000LU, 0x00200000LU, 0x00080000LU, 0x00000000LU, 
+               0x00180000LU, 0x00580000LU, 0x00280000LU, 0x00100000LU, 
0x00300000LU, 0x00500000LU, 0x00400000LU, 0x00680000LU, 
+               0x07b80000LU, 0x07f80000LU, 0x07e00000LU, 0x07f00000LU, 
0x07c80000LU, 0x07a00000LU, 0x07880000LU, 0x07800000LU, 
+               0x07980000LU, 0x07d80000LU, 0x07a80000LU, 0x07900000LU, 
0x07b00000LU, 0x07d00000LU, 0x07c00000LU, 0x07e80000LU, 
+               0x01380000LU, 0x01780000LU, 0x01600000LU, 0x01700000LU, 
0x01480000LU, 0x01200000LU, 0x01080000LU, 0x01000000LU, 
+               0x01180000LU, 0x01580000LU, 0x01280000LU, 0x01100000LU, 
0x01300000LU, 0x01500000LU, 0x01400000LU, 0x01680000LU, 
+               0x04380000LU, 0x04780000LU, 0x04600000LU, 0x04700000LU, 
0x04480000LU, 0x04200000LU, 0x04080000LU, 0x04000000LU, 
+               0x04180000LU, 0x04580000LU, 0x04280000LU, 0x04100000LU, 
0x04300000LU, 0x04500000LU, 0x04400000LU, 0x04680000LU, 
+               0x07380000LU, 0x07780000LU, 0x07600000LU, 0x07700000LU, 
0x07480000LU, 0x07200000LU, 0x07080000LU, 0x07000000LU, 
+               0x07180000LU, 0x07580000LU, 0x07280000LU, 0x07100000LU, 
0x07300000LU, 0x07500000LU, 0x07400000LU, 0x07680000LU, 
+               0x00b80000LU, 0x00f80000LU, 0x00e00000LU, 0x00f00000LU, 
0x00c80000LU, 0x00a00000LU, 0x00880000LU, 0x00800000LU, 
+               0x00980000LU, 0x00d80000LU, 0x00a80000LU, 0x00900000LU, 
0x00b00000LU, 0x00d00000LU, 0x00c00000LU, 0x00e80000LU, 
+               0x03380000LU, 0x03780000LU, 0x03600000LU, 0x03700000LU, 
0x03480000LU, 0x03200000LU, 0x03080000LU, 0x03000000LU, 
+               0x03180000LU, 0x03580000LU, 0x03280000LU, 0x03100000LU, 
0x03300000LU, 0x03500000LU, 0x03400000LU, 0x03680000LU, 
+               0x02b80000LU, 0x02f80000LU, 0x02e00000LU, 0x02f00000LU, 
0x02c80000LU, 0x02a00000LU, 0x02880000LU, 0x02800000LU, 
+               0x02980000LU, 0x02d80000LU, 0x02a80000LU, 0x02900000LU, 
0x02b00000LU, 0x02d00000LU, 0x02c00000LU, 0x02e80000LU, 
+               0x06b80000LU, 0x06f80000LU, 0x06e00000LU, 0x06f00000LU, 
0x06c80000LU, 0x06a00000LU, 0x06880000LU, 0x06800000LU, 
+               0x06980000LU, 0x06d80000LU, 0x06a80000LU, 0x06900000LU, 
0x06b00000LU, 0x06d00000LU, 0x06c00000LU, 0x06e80000LU, 
+               0x05b80000LU, 0x05f80000LU, 0x05e00000LU, 0x05f00000LU, 
0x05c80000LU, 0x05a00000LU, 0x05880000LU, 0x05800000LU, 
+               0x05980000LU, 0x05d80000LU, 0x05a80000LU, 0x05900000LU, 
0x05b00000LU, 0x05d00000LU, 0x05c00000LU, 0x05e80000LU, 
+               0x04b80000LU, 0x04f80000LU, 0x04e00000LU, 0x04f00000LU, 
0x04c80000LU, 0x04a00000LU, 0x04880000LU, 0x04800000LU, 
+               0x04980000LU, 0x04d80000LU, 0x04a80000LU, 0x04900000LU, 
0x04b00000LU, 0x04d00000LU, 0x04c00000LU, 0x04e80000LU, 
+               0x01b80000LU, 0x01f80000LU, 0x01e00000LU, 0x01f00000LU, 
0x01c80000LU, 0x01a00000LU, 0x01880000LU, 0x01800000LU, 
+               0x01980000LU, 0x01d80000LU, 0x01a80000LU, 0x01900000LU, 
0x01b00000LU, 0x01d00000LU, 0x01c00000LU, 0x01e80000LU, 
+       },
+       { /* table 3 */
+               0xb8000003LU, 0xb0000003LU, 0xa0000003LU, 0xd8000003LU, 
0xc8000003LU, 0xe0000003LU, 0x90000003LU, 0xd0000003LU, 
+               0x88000003LU, 0xc0000003LU, 0x80000003LU, 0xf0000003LU, 
0xf8000003LU, 0xe8000003LU, 0x98000003LU, 0xa8000003LU, 
+               0x38000003LU, 0x30000003LU, 0x20000003LU, 0x58000003LU, 
0x48000003LU, 0x60000003LU, 0x10000003LU, 0x50000003LU, 
+               0x08000003LU, 0x40000003LU, 0x00000003LU, 0x70000003LU, 
0x78000003LU, 0x68000003LU, 0x18000003LU, 0x28000003LU, 
+               0x38000001LU, 0x30000001LU, 0x20000001LU, 0x58000001LU, 
0x48000001LU, 0x60000001LU, 0x10000001LU, 0x50000001LU, 
+               0x08000001LU, 0x40000001LU, 0x00000001LU, 0x70000001LU, 
0x78000001LU, 0x68000001LU, 0x18000001LU, 0x28000001LU, 
+               0x38000002LU, 0x30000002LU, 0x20000002LU, 0x58000002LU, 
0x48000002LU, 0x60000002LU, 0x10000002LU, 0x50000002LU, 
+               0x08000002LU, 0x40000002LU, 0x00000002LU, 0x70000002LU, 
0x78000002LU, 0x68000002LU, 0x18000002LU, 0x28000002LU, 
+               0xb8000006LU, 0xb0000006LU, 0xa0000006LU, 0xd8000006LU, 
0xc8000006LU, 0xe0000006LU, 0x90000006LU, 0xd0000006LU, 
+               0x88000006LU, 0xc0000006LU, 0x80000006LU, 0xf0000006LU, 
0xf8000006LU, 0xe8000006LU, 0x98000006LU, 0xa8000006LU, 
+               0xb8000004LU, 0xb0000004LU, 0xa0000004LU, 0xd8000004LU, 
0xc8000004LU, 0xe0000004LU, 0x90000004LU, 0xd0000004LU, 
+               0x88000004LU, 0xc0000004LU, 0x80000004LU, 0xf0000004LU, 
0xf8000004LU, 0xe8000004LU, 0x98000004LU, 0xa8000004LU, 
+               0xb8000007LU, 0xb0000007LU, 0xa0000007LU, 0xd8000007LU, 
0xc8000007LU, 0xe0000007LU, 0x90000007LU, 0xd0000007LU, 
+               0x88000007LU, 0xc0000007LU, 0x80000007LU, 0xf0000007LU, 
0xf8000007LU, 0xe8000007LU, 0x98000007LU, 0xa8000007LU, 
+               0x38000000LU, 0x30000000LU, 0x20000000LU, 0x58000000LU, 
0x48000000LU, 0x60000000LU, 0x10000000LU, 0x50000000LU, 
+               0x08000000LU, 0x40000000LU, 0x00000000LU, 0x70000000LU, 
0x78000000LU, 0x68000000LU, 0x18000000LU, 0x28000000LU, 
+               0x38000005LU, 0x30000005LU, 0x20000005LU, 0x58000005LU, 
0x48000005LU, 0x60000005LU, 0x10000005LU, 0x50000005LU, 
+               0x08000005LU, 0x40000005LU, 0x00000005LU, 0x70000005LU, 
0x78000005LU, 0x68000005LU, 0x18000005LU, 0x28000005LU, 
+               0xb8000000LU, 0xb0000000LU, 0xa0000000LU, 0xd8000000LU, 
0xc8000000LU, 0xe0000000LU, 0x90000000LU, 0xd0000000LU, 
+               0x88000000LU, 0xc0000000LU, 0x80000000LU, 0xf0000000LU, 
0xf8000000LU, 0xe8000000LU, 0x98000000LU, 0xa8000000LU, 
+               0xb8000002LU, 0xb0000002LU, 0xa0000002LU, 0xd8000002LU, 
0xc8000002LU, 0xe0000002LU, 0x90000002LU, 0xd0000002LU, 
+               0x88000002LU, 0xc0000002LU, 0x80000002LU, 0xf0000002LU, 
0xf8000002LU, 0xe8000002LU, 0x98000002LU, 0xa8000002LU, 
+               0xb8000005LU, 0xb0000005LU, 0xa0000005LU, 0xd8000005LU, 
0xc8000005LU, 0xe0000005LU, 0x90000005LU, 0xd0000005LU, 
+               0x88000005LU, 0xc0000005LU, 0x80000005LU, 0xf0000005LU, 
0xf8000005LU, 0xe8000005LU, 0x98000005LU, 0xa8000005LU, 
+               0x38000004LU, 0x30000004LU, 0x20000004LU, 0x58000004LU, 
0x48000004LU, 0x60000004LU, 0x10000004LU, 0x50000004LU, 
+               0x08000004LU, 0x40000004LU, 0x00000004LU, 0x70000004LU, 
0x78000004LU, 0x68000004LU, 0x18000004LU, 0x28000004LU, 
+               0x38000007LU, 0x30000007LU, 0x20000007LU, 0x58000007LU, 
0x48000007LU, 0x60000007LU, 0x10000007LU, 0x50000007LU, 
+               0x08000007LU, 0x40000007LU, 0x00000007LU, 0x70000007LU, 
0x78000007LU, 0x68000007LU, 0x18000007LU, 0x28000007LU, 
+               0x38000006LU, 0x30000006LU, 0x20000006LU, 0x58000006LU, 
0x48000006LU, 0x60000006LU, 0x10000006LU, 0x50000006LU, 
+               0x08000006LU, 0x40000006LU, 0x00000006LU, 0x70000006LU, 
0x78000006LU, 0x68000006LU, 0x18000006LU, 0x28000006LU, 
+               0xb8000001LU, 0xb0000001LU, 0xa0000001LU, 0xd8000001LU, 
0xc8000001LU, 0xe0000001LU, 0x90000001LU, 0xd0000001LU, 
+               0x88000001LU, 0xc0000001LU, 0x80000001LU, 0xf0000001LU, 
0xf8000001LU, 0xe8000001LU, 0x98000001LU, 0xa8000001LU, 
+       },
+       { /* table 4 */
+               0x000000e8LU, 0x000000f0LU, 0x000000a0LU, 0x00000088LU, 
0x000000b8LU, 0x00000080LU, 0x000000a8LU, 0x000000d0LU, 
+               0x00000098LU, 0x000000e0LU, 0x000000c0LU, 0x000000f8LU, 
0x000000b0LU, 0x00000090LU, 0x000000c8LU, 0x000000d8LU, 
+               0x000001e8LU, 0x000001f0LU, 0x000001a0LU, 0x00000188LU, 
0x000001b8LU, 0x00000180LU, 0x000001a8LU, 0x000001d0LU, 
+               0x00000198LU, 0x000001e0LU, 0x000001c0LU, 0x000001f8LU, 
0x000001b0LU, 0x00000190LU, 0x000001c8LU, 0x000001d8LU, 
+               0x00000568LU, 0x00000570LU, 0x00000520LU, 0x00000508LU, 
0x00000538LU, 0x00000500LU, 0x00000528LU, 0x00000550LU, 
+               0x00000518LU, 0x00000560LU, 0x00000540LU, 0x00000578LU, 
0x00000530LU, 0x00000510LU, 0x00000548LU, 0x00000558LU, 
+               0x000004e8LU, 0x000004f0LU, 0x000004a0LU, 0x00000488LU, 
0x000004b8LU, 0x00000480LU, 0x000004a8LU, 0x000004d0LU, 
+               0x00000498LU, 0x000004e0LU, 0x000004c0LU, 0x000004f8LU, 
0x000004b0LU, 0x00000490LU, 0x000004c8LU, 0x000004d8LU, 
+               0x000002e8LU, 0x000002f0LU, 0x000002a0LU, 0x00000288LU, 
0x000002b8LU, 0x00000280LU, 0x000002a8LU, 0x000002d0LU, 
+               0x00000298LU, 0x000002e0LU, 0x000002c0LU, 0x000002f8LU, 
0x000002b0LU, 0x00000290LU, 0x000002c8LU, 0x000002d8LU, 
+               0x000005e8LU, 0x000005f0LU, 0x000005a0LU, 0x00000588LU, 
0x000005b8LU, 0x00000580LU, 0x000005a8LU, 0x000005d0LU, 
+               0x00000598LU, 0x000005e0LU, 0x000005c0LU, 0x000005f8LU, 
0x000005b0LU, 0x00000590LU, 0x000005c8LU, 0x000005d8LU, 
+               0x00000268LU, 0x00000270LU, 0x00000220LU, 0x00000208LU, 
0x00000238LU, 0x00000200LU, 0x00000228LU, 0x00000250LU, 
+               0x00000218LU, 0x00000260LU, 0x00000240LU, 0x00000278LU, 
0x00000230LU, 0x00000210LU, 0x00000248LU, 0x00000258LU, 
+               0x000007e8LU, 0x000007f0LU, 0x000007a0LU, 0x00000788LU, 
0x000007b8LU, 0x00000780LU, 0x000007a8LU, 0x000007d0LU, 
+               0x00000798LU, 0x000007e0LU, 0x000007c0LU, 0x000007f8LU, 
0x000007b0LU, 0x00000790LU, 0x000007c8LU, 0x000007d8LU, 
+               0x00000468LU, 0x00000470LU, 0x00000420LU, 0x00000408LU, 
0x00000438LU, 0x00000400LU, 0x00000428LU, 0x00000450LU, 
+               0x00000418LU, 0x00000460LU, 0x00000440LU, 0x00000478LU, 
0x00000430LU, 0x00000410LU, 0x00000448LU, 0x00000458LU, 
+               0x00000368LU, 0x00000370LU, 0x00000320LU, 0x00000308LU, 
0x00000338LU, 0x00000300LU, 0x00000328LU, 0x00000350LU, 
+               0x00000318LU, 0x00000360LU, 0x00000340LU, 0x00000378LU, 
0x00000330LU, 0x00000310LU, 0x00000348LU, 0x00000358LU, 
+               0x000003e8LU, 0x000003f0LU, 0x000003a0LU, 0x00000388LU, 
0x000003b8LU, 0x00000380LU, 0x000003a8LU, 0x000003d0LU, 
+               0x00000398LU, 0x000003e0LU, 0x000003c0LU, 0x000003f8LU, 
0x000003b0LU, 0x00000390LU, 0x000003c8LU, 0x000003d8LU, 
+               0x00000768LU, 0x00000770LU, 0x00000720LU, 0x00000708LU, 
0x00000738LU, 0x00000700LU, 0x00000728LU, 0x00000750LU, 
+               0x00000718LU, 0x00000760LU, 0x00000740LU, 0x00000778LU, 
0x00000730LU, 0x00000710LU, 0x00000748LU, 0x00000758LU, 
+               0x000006e8LU, 0x000006f0LU, 0x000006a0LU, 0x00000688LU, 
0x000006b8LU, 0x00000680LU, 0x000006a8LU, 0x000006d0LU, 
+               0x00000698LU, 0x000006e0LU, 0x000006c0LU, 0x000006f8LU, 
0x000006b0LU, 0x00000690LU, 0x000006c8LU, 0x000006d8LU, 
+               0x00000068LU, 0x00000070LU, 0x00000020LU, 0x00000008LU, 
0x00000038LU, 0x00000000LU, 0x00000028LU, 0x00000050LU, 
+               0x00000018LU, 0x00000060LU, 0x00000040LU, 0x00000078LU, 
0x00000030LU, 0x00000010LU, 0x00000048LU, 0x00000058LU, 
+               0x00000168LU, 0x00000170LU, 0x00000120LU, 0x00000108LU, 
0x00000138LU, 0x00000100LU, 0x00000128LU, 0x00000150LU, 
+               0x00000118LU, 0x00000160LU, 0x00000140LU, 0x00000178LU, 
0x00000130LU, 0x00000110LU, 0x00000148LU, 0x00000158LU, 
+               0x00000668LU, 0x00000670LU, 0x00000620LU, 0x00000608LU, 
0x00000638LU, 0x00000600LU, 0x00000628LU, 0x00000650LU, 
+               0x00000618LU, 0x00000660LU, 0x00000640LU, 0x00000678LU, 
0x00000630LU, 0x00000610LU, 0x00000648LU, 0x00000658LU, 
+       },
+};
diff --git a/ext/hash/tests/gost.phpt b/ext/hash/tests/gost.phpt
index b800e11..6ce0024 100644
--- a/ext/hash/tests/gost.phpt
+++ b/ext/hash/tests/gost.phpt
@@ -10,6 +10,13 @@ echo hash('gost', 'The quick brown fox jumps over the lazy 
cog'), "\n";
 echo hash('gost', str_repeat('a', 31)), "\n";
 echo hash('gost', str_repeat('a', 32)), "\n";
 echo hash('gost', str_repeat('a', 33)), "\n";
+
+echo hash('gost-crypto', ''), "\n";
+echo hash('gost-crypto', 'The quick brown fox jumps over the lazy dog'), "\n";
+echo hash('gost-crypto', 'The quick brown fox jumps over the lazy cog'), "\n";
+echo hash('gost-crypto', str_repeat('a', 31)), "\n";
+echo hash('gost-crypto', str_repeat('a', 32)), "\n";
+echo hash('gost-crypto', str_repeat('a', 33)), "\n";
 ?>
 --EXPECT--
 ce85b99cc46752fffee35cab9a7b0278abb4c2d2055cff685af4912c49490f8d
@@ -18,3 +25,9 @@ 
a3ebc4daaab78b0be131dab5737a7f67e602670d543521319150d2e14eeec445
 03840d6348763f11e28e7b1ecc4da0cdf7f898fa555b928ef684c6c5b8f46d9f
 fd1b746d9397e78edd311baef391450434271e02816caa37680d6d7381c79d4e
 715e59cdc8ebde9fdf0fe2a2e811b3bf7f48209a01505e467d2cd2aa2bbb5ecf
+981e5f3ca30c841487830f84fb433e13ac1101569b9c13584ac483234cd656c0
+9004294a361a508c586fe53d1f1b02746765e71b765472786e4770d565830a76
+a93124f5bf2c6d83c3bbf722bc55569310245ca5957541f4dbd7dfaf8137e6f2
+8978e06b0ecf54ea81ec51ca4e02bcb4eb390b3f04cb5f65ee8de195ffae591b
+e121e3740ae94ca6d289e6d653ff31695783efff3dd960417a1098a0130fa720
+d3e8f22d9762a148ddfc84a6043d97a608604dae7c05baee72b55f559d03dd74
-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to