20ANONYMOUS_NAMESPACE_BEGIN
24const unsigned int LSH512_MSG_BLK_BYTE_LEN = 256;
27const unsigned int LSH512_HASH_VAL_MAX_BYTE_LEN = 64;
30const unsigned int CV_WORD_LEN = 16;
31const unsigned int CONST_WORD_LEN = 8;
32const unsigned int HASH_VAL_MAX_WORD_LEN = 8;
33const unsigned int NUM_STEPS = 28;
35const unsigned int ROT_EVEN_ALPHA = 23;
36const unsigned int ROT_EVEN_BETA = 59;
37const unsigned int ROT_ODD_ALPHA = 7;
38const unsigned int ROT_ODD_BETA = 3;
40const unsigned int LSH_TYPE_512_512 = 0x0010040;
41const unsigned int LSH_TYPE_512_384 = 0x0010030;
42const unsigned int LSH_TYPE_512_256 = 0x0010020;
43const unsigned int LSH_TYPE_512_224 = 0x001001C;
50const unsigned int LSH_SUCCESS = 0x0;
53const unsigned int LSH_ERR_INVALID_DATABITLEN = 0x2403;
54const unsigned int LSH_ERR_INVALID_STATE = 0x2404;
58const unsigned int AlgorithmType = 80;
59const unsigned int RemainingBits = 81;
76CRYPTOPP_ALIGN_DATA(32)
78const
word64 LSH512_IV224[CV_WORD_LEN] = {
85CRYPTOPP_ALIGN_DATA(32)
87const
word64 LSH512_IV256[CV_WORD_LEN] = {
94CRYPTOPP_ALIGN_DATA(32)
96const
word64 LSH512_IV384[CV_WORD_LEN] = {
103CRYPTOPP_ALIGN_DATA(32)
105const
word64 LSH512_IV512[CV_WORD_LEN] = {
117const word64 LSH512_StepConstants[CONST_WORD_LEN * NUM_STEPS] = {
179ANONYMOUS_NAMESPACE_BEGIN
182using CryptoPP::word32;
183using CryptoPP::word64;
184using CryptoPP::rotlFixed;
185using CryptoPP::rotlConstant;
187using CryptoPP::GetBlock;
188using CryptoPP::LittleEndian;
189using CryptoPP::ConditionalByteReverse;
190using CryptoPP::LITTLE_ENDIAN_ORDER;
192using CryptoPP::LSH::LSH512_IV224;
193using CryptoPP::LSH::LSH512_IV256;
194using CryptoPP::LSH::LSH512_IV384;
195using CryptoPP::LSH::LSH512_IV512;
196using CryptoPP::LSH::LSH512_StepConstants;
208 cv_l(state+0), cv_r(state+8), sub_msgs(state+16),
209 last_block(reinterpret_cast<
byte*>(state+48)),
210 remain_databitlen(remainingBitLength),
211 alg_type(static_cast<lsh_type>(algType)) {}
217 lsh_u64& remain_databitlen;
221struct LSH512_Internal
223 LSH512_Internal(
word64* state) :
224 submsg_e_l(state+16), submsg_e_r(state+24),
225 submsg_o_l(state+32), submsg_o_r(state+40) { }
233const lsh_u32 g_gamma512[8] = { 0, 16, 32, 48, 8, 24, 40, 56 };
237inline bool LSH_IS_LSH512(lsh_uint val) {
238 return (val & 0xf0000) == 0x10000;
241inline lsh_uint LSH_GET_SMALL_HASHBIT(lsh_uint val) {
245inline lsh_uint LSH_GET_HASHBYTE(lsh_uint val) {
249inline lsh_uint LSH_GET_HASHBIT(lsh_uint val) {
250 return (LSH_GET_HASHBYTE(val) << 3) - LSH_GET_SMALL_HASHBIT(val);
253inline lsh_u64 loadLE64(lsh_u64 v) {
257lsh_u64 ROTL64(lsh_u64 x, lsh_u32 r) {
262inline void load_msg_blk(LSH512_Internal* i_state,
const lsh_u8* msgblk)
264 lsh_u64* submsg_e_l = i_state->submsg_e_l;
265 lsh_u64* submsg_e_r = i_state->submsg_e_r;
266 lsh_u64* submsg_o_l = i_state->submsg_o_l;
267 lsh_u64* submsg_o_r = i_state->submsg_o_r;
271 InBlock input(msgblk);
272 input(submsg_e_l[0])(submsg_e_l[1])(submsg_e_l[2])(submsg_e_l[3])
273 (submsg_e_l[4])(submsg_e_l[5])(submsg_e_l[6])(submsg_e_l[7])
274 (submsg_e_r[0])(submsg_e_r[1])(submsg_e_r[2])(submsg_e_r[3])
275 (submsg_e_r[4])(submsg_e_r[5])(submsg_e_r[6])(submsg_e_r[7])
276 (submsg_o_l[0])(submsg_o_l[1])(submsg_o_l[2])(submsg_o_l[3])
277 (submsg_o_l[4])(submsg_o_l[5])(submsg_o_l[6])(submsg_o_l[7])
278 (submsg_o_r[0])(submsg_o_r[1])(submsg_o_r[2])(submsg_o_r[3])
279 (submsg_o_r[4])(submsg_o_r[5])(submsg_o_r[6])(submsg_o_r[7]);
282inline void msg_exp_even(LSH512_Internal* i_state)
286 lsh_u64* submsg_e_l = i_state->submsg_e_l;
287 lsh_u64* submsg_e_r = i_state->submsg_e_r;
288 lsh_u64* submsg_o_l = i_state->submsg_o_l;
289 lsh_u64* submsg_o_r = i_state->submsg_o_r;
292 temp = submsg_e_l[0];
293 submsg_e_l[0] = submsg_o_l[0] + submsg_e_l[3];
294 submsg_e_l[3] = submsg_o_l[3] + submsg_e_l[1];
295 submsg_e_l[1] = submsg_o_l[1] + submsg_e_l[2];
296 submsg_e_l[2] = submsg_o_l[2] + temp;
297 temp = submsg_e_l[4];
298 submsg_e_l[4] = submsg_o_l[4] + submsg_e_l[7];
299 submsg_e_l[7] = submsg_o_l[7] + submsg_e_l[6];
300 submsg_e_l[6] = submsg_o_l[6] + submsg_e_l[5];
301 submsg_e_l[5] = submsg_o_l[5] + temp;
302 temp = submsg_e_r[0];
303 submsg_e_r[0] = submsg_o_r[0] + submsg_e_r[3];
304 submsg_e_r[3] = submsg_o_r[3] + submsg_e_r[1];
305 submsg_e_r[1] = submsg_o_r[1] + submsg_e_r[2];
306 submsg_e_r[2] = submsg_o_r[2] + temp;
307 temp = submsg_e_r[4];
308 submsg_e_r[4] = submsg_o_r[4] + submsg_e_r[7];
309 submsg_e_r[7] = submsg_o_r[7] + submsg_e_r[6];
310 submsg_e_r[6] = submsg_o_r[6] + submsg_e_r[5];
311 submsg_e_r[5] = submsg_o_r[5] + temp;
314inline void msg_exp_odd(LSH512_Internal* i_state)
318 lsh_u64* submsg_e_l = i_state->submsg_e_l;
319 lsh_u64* submsg_e_r = i_state->submsg_e_r;
320 lsh_u64* submsg_o_l = i_state->submsg_o_l;
321 lsh_u64* submsg_o_r = i_state->submsg_o_r;
324 temp = submsg_o_l[0];
325 submsg_o_l[0] = submsg_e_l[0] + submsg_o_l[3];
326 submsg_o_l[3] = submsg_e_l[3] + submsg_o_l[1];
327 submsg_o_l[1] = submsg_e_l[1] + submsg_o_l[2];
328 submsg_o_l[2] = submsg_e_l[2] + temp;
329 temp = submsg_o_l[4];
330 submsg_o_l[4] = submsg_e_l[4] + submsg_o_l[7];
331 submsg_o_l[7] = submsg_e_l[7] + submsg_o_l[6];
332 submsg_o_l[6] = submsg_e_l[6] + submsg_o_l[5];
333 submsg_o_l[5] = submsg_e_l[5] + temp;
334 temp = submsg_o_r[0];
335 submsg_o_r[0] = submsg_e_r[0] + submsg_o_r[3];
336 submsg_o_r[3] = submsg_e_r[3] + submsg_o_r[1];
337 submsg_o_r[1] = submsg_e_r[1] + submsg_o_r[2];
338 submsg_o_r[2] = submsg_e_r[2] + temp;
339 temp = submsg_o_r[4];
340 submsg_o_r[4] = submsg_e_r[4] + submsg_o_r[7];
341 submsg_o_r[7] = submsg_e_r[7] + submsg_o_r[6];
342 submsg_o_r[6] = submsg_e_r[6] + submsg_o_r[5];
343 submsg_o_r[5] = submsg_e_r[5] + temp;
346inline void load_sc(
const lsh_u64** p_const_v,
size_t i)
348 *p_const_v = &LSH512_StepConstants[i];
351inline void msg_add_even(lsh_u64 cv_l[8], lsh_u64 cv_r[8], LSH512_Internal* i_state)
355 lsh_u64* submsg_e_l = i_state->submsg_e_l;
356 lsh_u64* submsg_e_r = i_state->submsg_e_r;
358 cv_l[0] ^= submsg_e_l[0]; cv_l[1] ^= submsg_e_l[1];
359 cv_l[2] ^= submsg_e_l[2]; cv_l[3] ^= submsg_e_l[3];
360 cv_l[4] ^= submsg_e_l[4]; cv_l[5] ^= submsg_e_l[5];
361 cv_l[6] ^= submsg_e_l[6]; cv_l[7] ^= submsg_e_l[7];
362 cv_r[0] ^= submsg_e_r[0]; cv_r[1] ^= submsg_e_r[1];
363 cv_r[2] ^= submsg_e_r[2]; cv_r[3] ^= submsg_e_r[3];
364 cv_r[4] ^= submsg_e_r[4]; cv_r[5] ^= submsg_e_r[5];
365 cv_r[6] ^= submsg_e_r[6]; cv_r[7] ^= submsg_e_r[7];
368inline void msg_add_odd(lsh_u64 cv_l[8], lsh_u64 cv_r[8], LSH512_Internal* i_state)
372 lsh_u64* submsg_o_l = i_state->submsg_o_l;
373 lsh_u64* submsg_o_r = i_state->submsg_o_r;
375 cv_l[0] ^= submsg_o_l[0]; cv_l[1] ^= submsg_o_l[1];
376 cv_l[2] ^= submsg_o_l[2]; cv_l[3] ^= submsg_o_l[3];
377 cv_l[4] ^= submsg_o_l[4]; cv_l[5] ^= submsg_o_l[5];
378 cv_l[6] ^= submsg_o_l[6]; cv_l[7] ^= submsg_o_l[7];
379 cv_r[0] ^= submsg_o_r[0]; cv_r[1] ^= submsg_o_r[1];
380 cv_r[2] ^= submsg_o_r[2]; cv_r[3] ^= submsg_o_r[3];
381 cv_r[4] ^= submsg_o_r[4]; cv_r[5] ^= submsg_o_r[5];
382 cv_r[6] ^= submsg_o_r[6]; cv_r[7] ^= submsg_o_r[7];
385inline void add_blk(lsh_u64 cv_l[8], lsh_u64 cv_r[8])
397template <
unsigned int R>
398inline void rotate_blk(lsh_u64 cv[8])
400 cv[0] = rotlConstant<R>(cv[0]);
401 cv[1] = rotlConstant<R>(cv[1]);
402 cv[2] = rotlConstant<R>(cv[2]);
403 cv[3] = rotlConstant<R>(cv[3]);
404 cv[4] = rotlConstant<R>(cv[4]);
405 cv[5] = rotlConstant<R>(cv[5]);
406 cv[6] = rotlConstant<R>(cv[6]);
407 cv[7] = rotlConstant<R>(cv[7]);
410inline void xor_with_const(lsh_u64 cv_l[8],
const lsh_u64* const_v)
412 cv_l[0] ^= const_v[0];
413 cv_l[1] ^= const_v[1];
414 cv_l[2] ^= const_v[2];
415 cv_l[3] ^= const_v[3];
416 cv_l[4] ^= const_v[4];
417 cv_l[5] ^= const_v[5];
418 cv_l[6] ^= const_v[6];
419 cv_l[7] ^= const_v[7];
422inline void rotate_msg_gamma(lsh_u64 cv_r[8])
424 cv_r[1] = ROTL64(cv_r[1], g_gamma512[1]);
425 cv_r[2] = ROTL64(cv_r[2], g_gamma512[2]);
426 cv_r[3] = ROTL64(cv_r[3], g_gamma512[3]);
427 cv_r[4] = ROTL64(cv_r[4], g_gamma512[4]);
428 cv_r[5] = ROTL64(cv_r[5], g_gamma512[5]);
429 cv_r[6] = ROTL64(cv_r[6], g_gamma512[6]);
430 cv_r[7] = ROTL64(cv_r[7], g_gamma512[7]);
433inline void word_perm(lsh_u64 cv_l[8], lsh_u64 cv_r[8])
460template <
unsigned int Alpha,
unsigned int Beta>
461inline void mix(lsh_u64 cv_l[8], lsh_u64 cv_r[8],
const lsh_u64 const_v[8])
464 rotate_blk<Alpha>(cv_l);
465 xor_with_const(cv_l, const_v);
467 rotate_blk<Beta>(cv_r);
469 rotate_msg_gamma(cv_r);
476inline void compress(LSH512_Context* ctx,
const lsh_u8 pdMsgBlk[LSH512_MSG_BLK_BYTE_LEN])
480 LSH512_Internal s_state(ctx->cv_l);
481 LSH512_Internal* i_state = &s_state;
483 const lsh_u64* const_v = NULL;
484 lsh_u64 *cv_l = ctx->cv_l;
485 lsh_u64 *cv_r = ctx->cv_r;
487 load_msg_blk(i_state, pdMsgBlk);
489 msg_add_even(cv_l, cv_r, i_state);
490 load_sc(&const_v, 0);
491 mix<ROT_EVEN_ALPHA, ROT_EVEN_BETA>(cv_l, cv_r, const_v);
492 word_perm(cv_l, cv_r);
494 msg_add_odd(cv_l, cv_r, i_state);
495 load_sc(&const_v, 8);
496 mix<ROT_ODD_ALPHA, ROT_ODD_BETA>(cv_l, cv_r, const_v);
497 word_perm(cv_l, cv_r);
499 for (
size_t i = 1; i < NUM_STEPS / 2; i++)
501 msg_exp_even(i_state);
502 msg_add_even(cv_l, cv_r, i_state);
503 load_sc(&const_v, 16 * i);
504 mix<ROT_EVEN_ALPHA, ROT_EVEN_BETA>(cv_l, cv_r, const_v);
505 word_perm(cv_l, cv_r);
507 msg_exp_odd(i_state);
508 msg_add_odd(cv_l, cv_r, i_state);
509 load_sc(&const_v, 16 * i + 8);
510 mix<ROT_ODD_ALPHA, ROT_ODD_BETA>(cv_l, cv_r, const_v);
511 word_perm(cv_l, cv_r);
514 msg_exp_even(i_state);
515 msg_add_even(cv_l, cv_r, i_state);
520inline void load_iv(lsh_u64 cv_l[8], lsh_u64 cv_r[8],
const lsh_u64 iv[16])
540inline void zero_iv(lsh_u64 cv_l[8], lsh_u64 cv_r[8])
542 std::memset(cv_l, 0, 8*
sizeof(lsh_u64));
543 std::memset(cv_r, 0, 8*
sizeof(lsh_u64));
546inline void zero_submsgs(LSH512_Context* ctx)
548 lsh_u64* sub_msgs = ctx->sub_msgs;
550 std::memset(sub_msgs, 0x00, 32*
sizeof(lsh_u64));
553inline void init224(LSH512_Context* ctx)
558 load_iv(ctx->cv_l, ctx->cv_r, LSH512_IV224);
561inline void init256(LSH512_Context* ctx)
566 load_iv(ctx->cv_l, ctx->cv_r, LSH512_IV256);
569inline void init384(LSH512_Context* ctx)
574 load_iv(ctx->cv_l, ctx->cv_r, LSH512_IV384);
577inline void init512(LSH512_Context* ctx)
582 load_iv(ctx->cv_l, ctx->cv_r, LSH512_IV512);
587inline void fin(LSH512_Context* ctx)
591 for (
size_t i = 0; i < HASH_VAL_MAX_WORD_LEN; i++){
592 ctx->cv_l[i] = loadLE64(ctx->cv_l[i] ^ ctx->cv_r[i]);
598inline void get_hash(LSH512_Context* ctx, lsh_u8* pbHashVal)
604 lsh_uint alg_type = ctx->alg_type;
605 lsh_uint hash_val_byte_len = LSH_GET_HASHBYTE(alg_type);
606 lsh_uint hash_val_bit_len = LSH_GET_SMALL_HASHBIT(alg_type);
609 std::memcpy(pbHashVal, ctx->cv_l, hash_val_byte_len);
610 if (hash_val_bit_len){
611 pbHashVal[hash_val_byte_len-1] &= (((lsh_u8)0xff) << hash_val_bit_len);
617lsh_err lsh512_init(LSH512_Context* ctx)
622 lsh_u32 alg_type = ctx->alg_type;
623 const lsh_u64* const_v = NULL;
624 ctx->remain_databitlen = 0;
627 case LSH_TYPE_512_512:
630 case LSH_TYPE_512_384:
633 case LSH_TYPE_512_256:
636 case LSH_TYPE_512_224:
643 lsh_u64* cv_l = ctx->cv_l;
644 lsh_u64* cv_r = ctx->cv_r;
647 cv_l[0] = LSH512_HASH_VAL_MAX_BYTE_LEN;
648 cv_l[1] = LSH_GET_HASHBIT(alg_type);
650 for (
size_t i = 0; i < NUM_STEPS / 2; i++)
653 load_sc(&const_v, i * 16);
654 mix<ROT_EVEN_ALPHA, ROT_EVEN_BETA>(cv_l, cv_r, const_v);
655 word_perm(cv_l, cv_r);
657 load_sc(&const_v, i * 16 + 8);
658 mix<ROT_ODD_ALPHA, ROT_ODD_BETA>(cv_l, cv_r, const_v);
659 word_perm(cv_l, cv_r);
665lsh_err lsh512_update(LSH512_Context* ctx,
const lsh_u8* data,
size_t databitlen)
672 if (databitlen == 0){
677 size_t databytelen = databitlen >> 3;
679 const size_t pos2 = 0;
681 size_t remain_msg_byte =
static_cast<size_t>(ctx->remain_databitlen >> 3);
683 const size_t remain_msg_bit = 0;
685 if (remain_msg_byte >= LSH512_MSG_BLK_BYTE_LEN){
686 return LSH_ERR_INVALID_STATE;
688 if (remain_msg_bit > 0){
689 return LSH_ERR_INVALID_DATABITLEN;
692 if (databytelen + remain_msg_byte < LSH512_MSG_BLK_BYTE_LEN){
693 std::memcpy(ctx->last_block + remain_msg_byte, data, databytelen);
694 ctx->remain_databitlen += (lsh_uint)databitlen;
695 remain_msg_byte += (lsh_uint)databytelen;
697 ctx->last_block[remain_msg_byte] = data[databytelen] & ((0xff >> pos2) ^ 0xff);
702 if (remain_msg_byte > 0){
703 size_t more_byte = LSH512_MSG_BLK_BYTE_LEN - remain_msg_byte;
704 std::memcpy(ctx->last_block + remain_msg_byte, data, more_byte);
705 compress(ctx, ctx->last_block);
707 databytelen -= more_byte;
709 ctx->remain_databitlen = 0;
712 while (databytelen >= LSH512_MSG_BLK_BYTE_LEN)
718 data += LSH512_MSG_BLK_BYTE_LEN;
719 databytelen -= LSH512_MSG_BLK_BYTE_LEN;
722 if (databytelen > 0){
723 std::memcpy(ctx->last_block, data, databytelen);
724 ctx->remain_databitlen = (lsh_uint)(databytelen << 3);
728 ctx->last_block[databytelen] = data[databytelen] & ((0xff >> pos2) ^ 0xff);
729 ctx->remain_databitlen += pos2;
734lsh_err lsh512_final(LSH512_Context* ctx, lsh_u8* hashval)
740 size_t remain_msg_byte =
static_cast<size_t>(ctx->remain_databitlen >> 3);
742 const size_t remain_msg_bit = 0;
744 if (remain_msg_byte >= LSH512_MSG_BLK_BYTE_LEN){
745 return LSH_ERR_INVALID_STATE;
749 ctx->last_block[remain_msg_byte] |= (0x1 << (7 - remain_msg_bit));
752 ctx->last_block[remain_msg_byte] = 0x80;
754 std::memset(ctx->last_block + remain_msg_byte + 1, 0, LSH512_MSG_BLK_BYTE_LEN - remain_msg_byte - 1);
756 compress(ctx, ctx->last_block);
759 get_hash(ctx, hashval);
764ANONYMOUS_NAMESPACE_END
768#if defined(CRYPTOPP_ENABLE_64BIT_SSE)
769# if defined(CRYPTOPP_AVX2_AVAILABLE)
770 extern void LSH512_Base_Restart_AVX2(
word64* state);
771 extern void LSH512_Base_Update_AVX2(
word64* state,
const byte *input,
size_t size);
772 extern void LSH512_Base_TruncatedFinal_AVX2(
word64* state,
byte *hash,
size_t size);
774# if defined(CRYPTOPP_SSSE3_AVAILABLE)
775 extern void LSH512_Base_Restart_SSSE3(
word64* state);
776 extern void LSH512_Base_Update_SSSE3(
word64* state,
const byte *input,
size_t size);
777 extern void LSH512_Base_TruncatedFinal_SSSE3(
word64* state,
byte *hash,
size_t size);
783#if defined(CRYPTOPP_ENABLE_64BIT_SSE)
784#if defined(CRYPTOPP_AVX2_AVAILABLE)
789#if defined(CRYPTOPP_SSSE3_AVAILABLE)
799void LSH512_Base_Restart_CXX(
word64* state)
801 state[RemainingBits] = 0;
802 LSH512_Context ctx(state, state[AlgorithmType], state[RemainingBits]);
803 lsh_err err = lsh512_init(&ctx);
805 if (err != LSH_SUCCESS)
809void LSH512_Base_Update_CXX(
word64* state,
const byte *input,
size_t size)
811 LSH512_Context ctx(state, state[AlgorithmType], state[RemainingBits]);
812 lsh_err err = lsh512_update(&ctx, input, 8*size);
814 if (err != LSH_SUCCESS)
818void LSH512_Base_TruncatedFinal_CXX(
word64* state,
byte *hash,
size_t)
820 LSH512_Context ctx(state, state[AlgorithmType], state[RemainingBits]);
821 lsh_err err = lsh512_final(&ctx, hash);
823 if (err != LSH_SUCCESS)
830#if defined(CRYPTOPP_AVX2_AVAILABLE) && defined(CRYPTOPP_ENABLE_64BIT_SSE)
832 LSH512_Base_Restart_AVX2(m_state);
835#if defined(CRYPTOPP_SSSE3_AVAILABLE) && defined(CRYPTOPP_ENABLE_64BIT_SSE)
837 LSH512_Base_Restart_SSSE3(m_state);
841 LSH512_Base_Restart_CXX(m_state);
849#if defined(CRYPTOPP_AVX2_AVAILABLE) && defined(CRYPTOPP_ENABLE_64BIT_SSE)
851 LSH512_Base_Update_AVX2(m_state, input, size);
854#if defined(CRYPTOPP_SSSE3_AVAILABLE) && defined(CRYPTOPP_ENABLE_64BIT_SSE)
856 LSH512_Base_Update_SSSE3(m_state, input, size);
860 LSH512_Base_Update_CXX(m_state, input, size);
866 ThrowIfInvalidTruncatedSize(size);
871 byte fullHash[LSH512_HASH_VAL_MAX_BYTE_LEN];
874#if defined(CRYPTOPP_AVX2_AVAILABLE) && defined(CRYPTOPP_ENABLE_64BIT_SSE)
876 LSH512_Base_TruncatedFinal_AVX2(m_state, copyOut ? fullHash : hash, size);
879#if defined(CRYPTOPP_SSSE3_AVAILABLE) && defined(CRYPTOPP_ENABLE_64BIT_SSE)
881 LSH512_Base_TruncatedFinal_SSSE3(m_state, copyOut ? fullHash : hash, size);
885 LSH512_Base_TruncatedFinal_CXX(m_state, copyOut ? fullHash : hash, size);
888 std::memcpy(hash, fullHash, size);
Base class for all exceptions thrown by the library.
@ OTHER_ERROR
Some other error occurred not belonging to other categories.
Access a block of memory.
void Restart()
Restart the hash.
unsigned int DigestSize() const
Provides the digest size of the hash.
std::string AlgorithmProvider() const
Retrieve the provider of this algorithm.
void TruncatedFinal(byte *hash, size_t size)
Computes the hash of the current message.
void Update(const byte *input, size_t size)
Updates a hash with additional input.
Library configuration file.
unsigned char byte
8-bit unsigned datatype
#define W64LIT(x)
Declare an unsigned word64.
unsigned int word32
32-bit unsigned datatype
unsigned long long word64
64-bit unsigned datatype
Functions for CPU features and intrinsics.
@ LITTLE_ENDIAN_ORDER
byte order is little-endian
Classes for the LSH hash functions.
Utility functions for the Crypto++ library.
T ConditionalByteReverse(ByteOrder order, T value)
Reverses bytes in a value depending upon endianness.
T rotlFixed(T x, unsigned int y)
Performs a left rotate.
Crypto++ library namespace.
#define CRYPTOPP_ASSERT(exp)
Debugging and diagnostic assertion.