@@ -32,13 +32,16 @@ class hash_base : public object_base {
32
32
C_SHA512 = 6 ,
33
33
C_RIPEMD160 = 7 ,
34
34
C_SM3 = 8 ,
35
- C_KECCAK256 = 9 ,
36
- C_KECCAK384 = 10 ,
37
- C_KECCAK512 = 11 ,
38
- C_BLAKE2S = 12 ,
39
- C_BLAKE2B = 13 ,
40
- C_BLAKE2SP = 14 ,
41
- C_BLAKE2BP = 15
35
+ C_SHA3_256 = 9 ,
36
+ C_SHA3_384 = 10 ,
37
+ C_SHA3_512 = 11 ,
38
+ C_KECCAK256 = 12 ,
39
+ C_KECCAK384 = 13 ,
40
+ C_KECCAK512 = 14 ,
41
+ C_BLAKE2S = 15 ,
42
+ C_BLAKE2B = 16 ,
43
+ C_BLAKE2SP = 17 ,
44
+ C_BLAKE2BP = 18
42
45
};
43
46
44
47
public:
@@ -53,6 +56,9 @@ class hash_base : public object_base {
53
56
static result_t ripemd160 (Buffer_base* data, obj_ptr<Digest_base>& retVal);
54
57
static result_t sm3 (Buffer_base* data, obj_ptr<Digest_base>& retVal);
55
58
static result_t sm3 (PKey_base* pubKey, exlib::string id, Buffer_base* data, obj_ptr<Digest_base>& retVal);
59
+ static result_t sha3_256 (Buffer_base* data, obj_ptr<Digest_base>& retVal);
60
+ static result_t sha3_384 (Buffer_base* data, obj_ptr<Digest_base>& retVal);
61
+ static result_t sha3_512 (Buffer_base* data, obj_ptr<Digest_base>& retVal);
56
62
static result_t keccak256 (Buffer_base* data, obj_ptr<Digest_base>& retVal);
57
63
static result_t keccak384 (Buffer_base* data, obj_ptr<Digest_base>& retVal);
58
64
static result_t keccak512 (Buffer_base* data, obj_ptr<Digest_base>& retVal);
@@ -70,6 +76,9 @@ class hash_base : public object_base {
70
76
static result_t hmac_ripemd160 (Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
71
77
static result_t hmac_sm3 (Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
72
78
static result_t hmac_sm3 (PKey_base* pubKey, exlib::string id, Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
79
+ static result_t hmac_sha3_256 (Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
80
+ static result_t hmac_sha3_384 (Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
81
+ static result_t hmac_sha3_512 (Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
73
82
static result_t hmac_keccak256 (Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
74
83
static result_t hmac_keccak384 (Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
75
84
static result_t hmac_keccak512 (Buffer_base* key, Buffer_base* data, obj_ptr<Digest_base>& retVal);
@@ -97,6 +106,9 @@ class hash_base : public object_base {
97
106
static void s_static_sha512 (const v8::FunctionCallbackInfo<v8::Value>& args);
98
107
static void s_static_ripemd160 (const v8::FunctionCallbackInfo<v8::Value>& args);
99
108
static void s_static_sm3 (const v8::FunctionCallbackInfo<v8::Value>& args);
109
+ static void s_static_sha3_256 (const v8::FunctionCallbackInfo<v8::Value>& args);
110
+ static void s_static_sha3_384 (const v8::FunctionCallbackInfo<v8::Value>& args);
111
+ static void s_static_sha3_512 (const v8::FunctionCallbackInfo<v8::Value>& args);
100
112
static void s_static_keccak256 (const v8::FunctionCallbackInfo<v8::Value>& args);
101
113
static void s_static_keccak384 (const v8::FunctionCallbackInfo<v8::Value>& args);
102
114
static void s_static_keccak512 (const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -113,6 +125,9 @@ class hash_base : public object_base {
113
125
static void s_static_hmac_sha512 (const v8::FunctionCallbackInfo<v8::Value>& args);
114
126
static void s_static_hmac_ripemd160 (const v8::FunctionCallbackInfo<v8::Value>& args);
115
127
static void s_static_hmac_sm3 (const v8::FunctionCallbackInfo<v8::Value>& args);
128
+ static void s_static_hmac_sha3_256 (const v8::FunctionCallbackInfo<v8::Value>& args);
129
+ static void s_static_hmac_sha3_384 (const v8::FunctionCallbackInfo<v8::Value>& args);
130
+ static void s_static_hmac_sha3_512 (const v8::FunctionCallbackInfo<v8::Value>& args);
116
131
static void s_static_hmac_keccak256 (const v8::FunctionCallbackInfo<v8::Value>& args);
117
132
static void s_static_hmac_keccak384 (const v8::FunctionCallbackInfo<v8::Value>& args);
118
133
static void s_static_hmac_keccak512 (const v8::FunctionCallbackInfo<v8::Value>& args);
@@ -140,6 +155,9 @@ inline ClassInfo& hash_base::class_info()
140
155
{ " sha512" , s_static_sha512, true , false },
141
156
{ " ripemd160" , s_static_ripemd160, true , false },
142
157
{ " sm3" , s_static_sm3, true , false },
158
+ { " sha3_256" , s_static_sha3_256, true , false },
159
+ { " sha3_384" , s_static_sha3_384, true , false },
160
+ { " sha3_512" , s_static_sha3_512, true , false },
143
161
{ " keccak256" , s_static_keccak256, true , false },
144
162
{ " keccak384" , s_static_keccak384, true , false },
145
163
{ " keccak512" , s_static_keccak512, true , false },
@@ -156,6 +174,9 @@ inline ClassInfo& hash_base::class_info()
156
174
{ " hmac_sha512" , s_static_hmac_sha512, true , false },
157
175
{ " hmac_ripemd160" , s_static_hmac_ripemd160, true , false },
158
176
{ " hmac_sm3" , s_static_hmac_sm3, true , false },
177
+ { " hmac_sha3_256" , s_static_hmac_sha3_256, true , false },
178
+ { " hmac_sha3_384" , s_static_hmac_sha3_384, true , false },
179
+ { " hmac_sha3_512" , s_static_hmac_sha3_512, true , false },
159
180
{ " hmac_keccak256" , s_static_hmac_keccak256, true , false },
160
181
{ " hmac_keccak384" , s_static_hmac_keccak384, true , false },
161
182
{ " hmac_keccak512" , s_static_hmac_keccak512, true , false },
@@ -174,6 +195,9 @@ inline ClassInfo& hash_base::class_info()
174
195
{ " SHA512" , C_SHA512 },
175
196
{ " RIPEMD160" , C_RIPEMD160 },
176
197
{ " SM3" , C_SM3 },
198
+ { " SHA3_256&qu
1E0A
ot; , C_SHA3_256 },
199
+ { " SHA3_384" , C_SHA3_384 },
200
+ { " SHA3_512" , C_SHA3_512 },
177
201
{ " KECCAK256" , C_KECCAK256 },
178
202
{ " KECCAK384" , C_KECCAK384 },
179
203
{ " KECCAK512" , C_KECCAK512 },
@@ -337,6 +361,51 @@ inline void hash_base::s_static_sm3(const v8::FunctionCallbackInfo<v8::Value>& a
337
361
METHOD_RETURN ();
338
362
}
339
363
364
+ inline void hash_base::s_static_sha3_256 (const v8::FunctionCallbackInfo<v8::Value>& args)
365
+ {
366
+ obj_ptr<Digest_base> vr;
367
+
368
+ METHOD_ENTER ();
369
+
370
+ METHOD_OVER (1 , 0 );
371
+
372
+ OPT_ARG (obj_ptr<Buffer_base>, 0 , NULL );
373
+
374
+ hr = sha3_256 (v0, vr);
375
+
376
+ METHOD_RETURN ();
377
+ }
378
+
379
+ inline void hash_base::s_static_sha3_384 (const v8::FunctionCallbackInfo<v8::Value>& args)
380
+ {
381
+ obj_ptr<Digest_base> vr;
382
+
383
+ METHOD_ENTER ();
384
+
385
+ METHOD_OVER (1 , 0 );
386
+
387
+ OPT_ARG (obj_ptr<Buffer_base>, 0 , NULL );
388
+
389
+ hr = sha3_384 (v0, vr);
390
+
391
+ METHOD_RETURN ();
392
+ }
393
+
394
+ inline void hash_base::s_static_sha3_512 (const v8::FunctionCallbackInfo<v8::Value>& args)
395
+ {
396
+ obj_ptr<Digest_base> vr;
397
+
398
+ METHOD_ENTER ();
399
+
400
+ METHOD_OVER (1 , 0 );
401
+
402
+ OPT_ARG (obj_ptr<Buffer_base>, 0 , NULL );
403
+
404
+ hr = sha3_512 (v0, vr);
405
+
406
+ METHOD_RETURN ();
407
+ }
408
+
340
409
inline void hash_base::s_static_keccak256 (const v8::FunctionCallbackInfo<v8::Value>& args)
341
410
{
342
411
obj_ptr<Digest_base> vr;
@@ -596,6 +665,54 @@ inline void hash_base::s_static_hmac_sm3(const v8::FunctionCallbackInfo<v8::Valu
596
665
METHOD_RETURN ();
597
666
}
598
667
668
+ inline void hash_base::s_static_hmac_sha3_256 (const v8::FunctionCallbackInfo<v8::Value>& args)
669
+ {
670
+ obj_ptr<Digest_base> vr;
671
+
672
+ METHOD_ENTER ();
673
+
674
+ METHOD_OVER (2 , 1 );
675
+
676
+ ARG (obj_ptr<Buffer_base>, 0 );
677
+ OPT_ARG (obj_ptr<Buffer_base>, 1 , NULL );
678
+
679
+ hr = hmac_sha3_256 (v0, v1, vr);
680
+
681
+ METHOD_RETURN ();
682
+ }
683
+
684
+ inline void hash_base::s_static_hmac_sha3_384 (const v8::FunctionCallbackInfo<v8::Value>& args)
685
+ {
686
+ obj_ptr<Digest_base> vr;
687
+
688
+ METHOD_ENTER ();
689
+
690
+ METHOD_OVER (2 , 1 );
691
+
692
+ ARG (obj_ptr<Buffer_base>, 0 );
693
+ OPT_ARG (obj_ptr<Buffer_base>, 1 , NULL );
694
+
695
+ hr = hmac_sha3_384 (v0, v1, vr);
696
+
697
+ METHOD_RETURN ();
698
+ }
699
+
700
+ inline void hash_base::s_static_hmac_sha3_512 (const v8::FunctionCallbackInfo<v8::Value>& args)
701
+ {
702
+ obj_ptr<Digest_base> vr;
703
+
704
+ METHOD_ENTER ();
705
+
706
+ METHOD_OVER (2 , 1 );
707
+
708
+ ARG (obj_ptr<Buffer_base>, 0 );
709
+ OPT_ARG (obj_ptr<Buffer_base>, 1 , NULL );
710
+
711
+ hr = hmac_sha3_512 (v0, v1, vr);
712
+
713
+ METHOD_RETURN ();
714
+ }
715
+
599
716
inline void hash_base::s_static_hmac_keccak256 (const v8::FunctionCallbackInfo<v8::Value>& args)
600
717
{
601
718
obj_ptr<Digest_base> vr;
0 commit comments