libxcks  0.1.0.1
ckfactory.cpp
Go to the documentation of this file.
1 /*
2  * libxcks
3  * Copyright (C) 2022 Julien Couot
4  *
5  * This program is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU Lesser General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
13  * License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
26 //---------------------------------------------------------------------------
27 #include <boost/locale.hpp>
28 #include <cstring>
29 
30 #include "libxcks/ckfactory.hpp"
31 
32 #include "libxcks/defs.hpp"
33 #include "strutil.hpp"
34 #include "blake3.hpp"
35 #include "crc32.hpp"
36 #include "crc64.hpp"
37 #include "md2.hpp"
38 #include "md4.hpp"
39 #include "md5.hpp"
40 #include "rmd160.hpp"
41 #include "sha1.hpp"
42 #include "sha224_256.hpp"
43 #include "sha384_512.hpp"
44 #include "keccak.hpp"
45 #include "sm3.hpp"
46 #include "tiger.hpp"
47 #include "whirlpool.hpp"
48 //---------------------------------------------------------------------------
49 
50 
52 using namespace std;
53 
54 // The Boost.Locale namespace.
55 using namespace boost::locale;
56 //---------------------------------------------------------------------------
57 
58 
59 namespace libxcks
60 {
63 
64 
65 //###########################################################################
66 // ChecksumFactory::ChecksumEntry members
67 //###########################################################################
73 {
74  public:
76  std::string name;
78  std::string descr;
80 
81  protected:
82  // Clones the source instance in this instance.
83  void clone(const ChecksumEntry& source);
84 
85  public:
87  ChecksumEntry() { fnctGetChecksum = nullptr; }
88 
89  // Constructor.
90  ChecksumEntry(FnctGetChecksum* getChecksum, const std::string& name,
91  const ArrayString& alternativeNames,
92  const std::string& description);
93 
99  ChecksumEntry(const ChecksumEntry& source) { clone(source); };
100 
107  ChecksumEntry& operator=(const ChecksumEntry& source) { clone(source); return *this; };
108 };
109 //---------------------------------------------------------------------------
110 
111 
122 ChecksumFactory::ChecksumEntry::ChecksumEntry(FnctGetChecksum* getChecksum,
123  const std::string& name,
124  const ArrayString& alternativeNames,
125  const std::string& description) :
126  fnctGetChecksum(getChecksum), name(name), altNames(alternativeNames),
127  descr(description)
128 {
129  if (getChecksum != nullptr)
130  {
131  Checksum* c = getChecksum();
132  if (c != nullptr)
133  {
134  const size_t size = c->getSize();
135  uint8_t* buf = new uint8_t[size];
136  memset(buf, 0, size);
137  nullValue.setValue(buf, size, c->getID());
138 
139  delete[] buf;
140  delete c;
141  }
142  }
143 }
144 //---------------------------------------------------------------------------
145 
146 
153 {
154  if (this != &source)
155  {
156  this->fnctGetChecksum = source.fnctGetChecksum;
157  this->name = source.name;
158  this->altNames = source.altNames;
159  this->descr = source.descr;
160  this->nullValue = source.nullValue;
161  }
162 }
163 //---------------------------------------------------------------------------
164 
165 
166 
167 
168 //###########################################################################
169 // ChecksumFactory members
170 //###########################################################################
171 
172 // Static attributes of the ChecksumFactory class
173 ChecksumFactory::ChecksumEntries ChecksumFactory::checksumAlgorithms;
174 //---------------------------------------------------------------------------
175 
176 
184 {
185  checksumAlgorithms.emplace(BLAKE3::getIdentifier(),
187  BLAKE3::getAlternativeNames(), translate("BLAKE3 cryptographic hash function").str(libxcks_domain)));
188  checksumAlgorithms.emplace(CRC32::getIdentifier(),
190  CRC32::getAlternativeNames(), translate("CRC32 cyclic redundancy check algorithm").str(libxcks_domain)));
191  checksumAlgorithms.emplace(CRC64::getIdentifier(),
193  CRC64::getAlternativeNames(), translate("CRC64 cyclic redundancy check algorithm").str(libxcks_domain)));
194  checksumAlgorithms.emplace(MD2::getIdentifier(),
196  MD2::getAlternativeNames(), translate("MD2 cryptographic hash function").str(libxcks_domain)));
197  checksumAlgorithms.emplace(MD4::getIdentifier(),
199  MD4::getAlternativeNames(), translate("MD4 cryptographic hash function").str(libxcks_domain)));
200  checksumAlgorithms.emplace(MD5::getIdentifier(),
202  MD5::getAlternativeNames(), translate("MD5 cryptographic hash function").str(libxcks_domain)));
203  checksumAlgorithms.emplace(RIPEMD160::getIdentifier(),
205  RIPEMD160::getAlternativeNames(), translate("RIPEMD-160 cryptographic hash function").str(libxcks_domain)));
206  checksumAlgorithms.emplace(SHA1::getIdentifier(),
208  SHA1::getAlternativeNames(), translate("SHA1 cryptographic hash function").str(libxcks_domain)));
209  checksumAlgorithms.emplace(SHA224::getIdentifier(),
211  SHA224::getAlternativeNames(), translate("SHA224 cryptographic hash function").str(libxcks_domain)));
212  checksumAlgorithms.emplace(SHA256::getIdentifier(),
214  SHA256::getAlternativeNames(), translate("SHA256 cryptographic hash function").str(libxcks_domain)));
215  checksumAlgorithms.emplace(SHA384::getIdentifier(),
217  SHA384::getAlternativeNames(), translate("SHA384 cryptographic hash function").str(libxcks_domain)));
218  checksumAlgorithms.emplace(SHA512::getIdentifier(),
220  SHA512::getAlternativeNames(), translate("SHA512 cryptographic hash function").str(libxcks_domain)));
221  checksumAlgorithms.emplace(SHA3_224::getIdentifier(),
223  SHA3_224::getAlternativeNames(), translate("SHA3-224 cryptographic hash function").str(libxcks_domain)));
224  checksumAlgorithms.emplace(SHA3_256::getIdentifier(),
226  SHA3_256::getAlternativeNames(), translate("SHA3-256 cryptographic hash function").str(libxcks_domain)));
227  checksumAlgorithms.emplace(SHA3_384::getIdentifier(),
229  SHA3_384::getAlternativeNames(), translate("SHA3-384 cryptographic hash function").str(libxcks_domain)));
230  checksumAlgorithms.emplace(SHA3_512::getIdentifier(),
232  SHA3_512::getAlternativeNames(), translate("SHA3-512 cryptographic hash function").str(libxcks_domain)));
233  #if 0
234  checksumAlgorithms.emplace(Keccak224::getIdentifier(),
235  ChecksumEntry(Keccak224::getNewInstance, Keccak224::getHashName(),
236  Keccak224::getAlternativeNames(), translate("Keccak224 cryptographic hash function").str(libxcks_domain)));
237  checksumAlgorithms.emplace(Keccak256::getIdentifier(),
238  ChecksumEntry(Keccak256::getNewInstance, Keccak256::getHashName(),
239  Keccak256::getAlternativeNames(), translate("Keccak256 cryptographic hash function").str(libxcks_domain)));
240  checksumAlgorithms.emplace(Keccak384::getIdentifier(),
241  ChecksumEntry(Keccak384::getNewInstance, Keccak384::getHashName(),
242  Keccak384::getAlternativeNames(), translate("Keccak384 cryptographic hash function").str(libxcks_domain)));
243  checksumAlgorithms.emplace(Keccak512::getIdentifier(),
244  ChecksumEntry(Keccak512::getNewInstance, Keccak512::getHashName(),
245  Keccak512::getAlternativeNames(), translate("Keccak512 cryptographic hash function").str(libxcks_domain)));
246  #endif
247  checksumAlgorithms.emplace(SM3::getIdentifier(),
249  SM3::getAlternativeNames(), translate("SM3 cryptographic hash function").str(libxcks_domain)));
250  checksumAlgorithms.emplace(Tiger::getIdentifier(),
252  Tiger::getAlternativeNames(), translate("Tiger cryptographic hash function").str(libxcks_domain)));
253  checksumAlgorithms.emplace(Whirlpool::getIdentifier(),
255  Whirlpool::getAlternativeNames(), translate("Whirlpool cryptographic hash function").str(libxcks_domain)));
256 }
257 //---------------------------------------------------------------------------
258 
259 
264 {
265  checksumAlgorithms.clear();
266 }
267 //---------------------------------------------------------------------------
268 
269 
283 {
284  if (exists(id))
285  return checksumAlgorithms[id].fnctGetChecksum();
286  else
287  return nullptr;
288 }
289 //---------------------------------------------------------------------------
290 
291 
306 Checksum* ChecksumFactory::getNewInstance(const std::string& name,
307  const bool lookInAltNames)
308 {
309  ChecksumAlgoId id;
310  if (getAlgorithmId(id, name, lookInAltNames))
311  return checksumAlgorithms[id].fnctGetChecksum();
312  else
313  return nullptr;
314 }
315 //---------------------------------------------------------------------------
316 
317 
328 {
329  if (exists(id))
330  return checksumAlgorithms[id].nullValue;
331  else
332  return ChecksumValue();
333 }
334 //---------------------------------------------------------------------------
335 
336 
349  const bool lookInAltNames)
350 {
351  ChecksumAlgoId id;
352  if (getAlgorithmId(id, name, lookInAltNames))
353  return checksumAlgorithms[id].nullValue;
354  else
355  return ChecksumValue();
356 }
357 //---------------------------------------------------------------------------
358 
359 
369 {
370  if (exists(id))
371  return checksumAlgorithms[id].nullValue.getSize();
372  else
373  return SIZE_MAX;
374 }
375 //---------------------------------------------------------------------------
376 
377 
388 size_t ChecksumFactory::getSize(const std::string& name, const bool lookInAltNames)
389 {
390  ChecksumAlgoId id;
391  if (getAlgorithmId(id, name, lookInAltNames))
392  return checksumAlgorithms[id].nullValue.getSize();
393  else
394  return SIZE_MAX;
395 }
396 //---------------------------------------------------------------------------
397 
398 
410 {
411  const ChecksumEntries& ca = checksumAlgorithms;
412  ChecksumEntries::const_iterator it = ca.find(id);
413 
414  return (it != ca.end());
415 }
416 //---------------------------------------------------------------------------
417 
418 
430 bool ChecksumFactory::exists(const std::string& name, const bool lookInAltNames)
431 {
432  ChecksumAlgoId id;
433  return getAlgorithmId(id, name, lookInAltNames);
434 }
435 //---------------------------------------------------------------------------
436 
437 
449 bool ChecksumFactory::existsNoCase(const string& name, const bool lookInAltNames)
450 {
451  ChecksumAlgoId id;
452  return getAlgorithmIdNoCase(id, name, lookInAltNames);
453 }
454 //---------------------------------------------------------------------------
455 
456 
463 {
465  res.reserve(checksumAlgorithms.size());
466 
467  const ChecksumEntries& ca = checksumAlgorithms;
468  for (ChecksumEntries::const_iterator it = ca.begin(); it != ca.end(); it++)
469  res.push_back(it->first);
470 
471  return res;
472 }
473 //---------------------------------------------------------------------------
474 
475 
482 {
483  ArrayString res;
484  res.reserve(checksumAlgorithms.size());
485 
486  const ChecksumEntries& ca = checksumAlgorithms;
487  for (ChecksumEntries::const_iterator it = ca.begin(); it != ca.end(); it++)
488  res.emplace_back(it->second.name);
489 
490  return res;
491 }
492 //---------------------------------------------------------------------------
493 
494 
501 {
502  return checksumAlgorithms.size();
503 }
504 //---------------------------------------------------------------------------
505 
506 
518 bool ChecksumFactory::getAlgorithmId(ChecksumAlgoId& id, const string& name,
519  const bool lookInAltNames)
520 {
521  bool found = false;
522 
523  const ChecksumEntries& ca = checksumAlgorithms;
524  ChecksumEntries::const_iterator it = ca.begin();
525  while (!found && it != ca.end())
526  {
527  if (it->second.name == name)
528  {
529  id = it->first;
530  found = true;
531  }
532  else if (lookInAltNames)
533  {
534  const ArrayString& altNames = it->second.altNames;
535  size_t s = altNames.size();
536  size_t i = 0;
537  while (!found && i < s)
538  {
539  if (altNames[i] == name)
540  {
541  found = true;
542  id = it->first;
543  }
544 
545  i++;
546  }
547  }
548 
549  it++;
550  }
551 
552  return found;
553 }
554 //---------------------------------------------------------------------------
555 
556 
570  const bool lookInAltNames)
571 {
572  bool found = false;
573 
574  const ChecksumEntries& ca = checksumAlgorithms;
575  ChecksumEntries::const_iterator it = ca.begin();
576  while (!found && it != ca.end())
577  {
578  if (stringICompare(it->second.name, name))
579  {
580  id = it->first;
581  found = true;
582  }
583  else if (lookInAltNames)
584  {
585  const ArrayString& altNames = it->second.altNames;
586  size_t s = altNames.size();
587  size_t i = 0;
588  while (!found && i < s)
589  {
590  if (stringICompare(altNames[i], name))
591  {
592  found = true;
593  id = it->first;
594  }
595 
596  i++;
597  }
598  }
599 
600  it++;
601  }
602 
603  return found;
604 }
605 //---------------------------------------------------------------------------
606 
607 
617 bool ChecksumFactory::getAlgorithmName(std::string& name, const ChecksumAlgoId id)
618 {
619  if (exists(id))
620  {
621  name = checksumAlgorithms[id].name;
622  return true;
623  }
624 
625  return false;
626 }
627 //---------------------------------------------------------------------------
628 
629 
641 bool ChecksumFactory::getAlgorithmName(std::string& name, const std::string& altName)
642 {
643  ChecksumAlgoId id;
644  if (getAlgorithmId(id, altName, true))
645  return getAlgorithmName(name, id);
646 
647  return false;
648 }
649 //---------------------------------------------------------------------------
650 
651 
668  const ChecksumAlgoId id,
669  const bool giveName)
670 {
671  if (exists(id))
672  {
673  altNames = checksumAlgorithms[id].altNames;
674  if (giveName)
675  altNames.emplace(altNames.begin(), checksumAlgorithms[id].name);
676  return true;
677  }
678 
679  return false;
680 }
681 //---------------------------------------------------------------------------
682 
683 
704  const std::string& name,
705  const bool nameCouldBeAlt,
706  const bool giveName)
707 {
708  ChecksumAlgoId id;
709  if (getAlgorithmId(id, name, nameCouldBeAlt))
710  return getAlgorithmAltNames(altNames, id, giveName);
711 
712  return false;
713 }
714 //---------------------------------------------------------------------------
715 
716 
727 {
728  if (exists(id))
729  return checksumAlgorithms[id].descr;
730 
731  return string();
732 }
733 //---------------------------------------------------------------------------
734 
735 
747 std::string ChecksumFactory::getAlgorithmDescription(const std::string& name,
748  const bool lookInAltNames)
749 {
750  ChecksumAlgoId id;
751  if (getAlgorithmId(id, name, lookInAltNames))
752  return checksumAlgorithms[id].descr;
753 
754  return string();
755 }
756 //---------------------------------------------------------------------------
757 } // namespace libxcks
758 //---------------------------------------------------------------------------
Compute BLAKE3 hash.
Checksum *() FnctGetChecksum()
Pointer to a function which returns a pointer on a new instance of the Checksum class.
Definition: ckfactory.cpp:62
Classes for enumerate and create all the checksums' algorithms that the application knows.
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: blake3.hpp:288
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: blake3.hpp:301
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: blake3.hpp:274
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the checksum algorithm.
Definition: crc32.hpp:169
static ArrayString getAlternativeNames()
Returns the alternative names of the CRC32 checksum algorithm.
Definition: crc32.cpp:181
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: crc32.hpp:189
static std::string getChecksumName()
Returns the name of the checksum algorithm.
Definition: crc32.hpp:154
static std::string getChecksumName()
Returns the name of the checksum algorithm.
Definition: crc64.hpp:153
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: crc64.hpp:188
static ArrayString getAlternativeNames()
Returns the alternative names of the CRC64 checksum algorithm.
Definition: crc64.cpp:155
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the checksum algorithm.
Definition: crc64.hpp:168
Represents an entry of the checksum or hash algorithms that the application knows.
Definition: ckfactory.cpp:73
void clone(const ChecksumEntry &source)
Clones the source instance in this instance.
Definition: ckfactory.cpp:152
ArrayString altNames
Alternative name(s) of the checksum or hash algorithm.
Definition: ckfactory.cpp:77
FnctGetChecksum * fnctGetChecksum
Pointer on a function that gives a pointer on a new instance of the Checksum class.
Definition: ckfactory.cpp:75
ChecksumValue nullValue
The null value of the the checksum or hash.
Definition: ckfactory.cpp:79
std::string descr
Description of the checksum or hash algorithm.
Definition: ckfactory.cpp:78
std::string name
Name of the checksum or hash algorithm.
Definition: ckfactory.cpp:76
ChecksumEntry()
Default constructor.
Definition: ckfactory.cpp:87
ChecksumEntry & operator=(const ChecksumEntry &source)
Assignment operator.
Definition: ckfactory.cpp:107
ChecksumEntry(const ChecksumEntry &source)
Copy constructor.
Definition: ckfactory.cpp:99
static bool existsNoCase(const std::string &name, const bool lookInAltNames=true)
Returns true if the given name of the checksum or hash algorithm exists with no case comparison.
Definition: ckfactory.cpp:449
static ArrayString getAlgorithmsNames()
Returns all the names of the available checksum or hash algorithms.
Definition: ckfactory.cpp:481
static ArrayChecksumAlgoId getAlgorithmsIds()
Returns all the identifiers of the available checksum or hash algorithms.
Definition: ckfactory.cpp:462
static ChecksumValue getNullValue(const ChecksumAlgoId id)
Gives null value of the specified checksum or hash identifier.
Definition: ckfactory.cpp:327
static size_t getSize(const ChecksumAlgoId id)
Gets the size in bytes of the specified checksum or hash identifier.
Definition: ckfactory.cpp:368
static bool getAlgorithmAltNames(ArrayString &altNames, const ChecksumAlgoId id, const bool giveName=false)
Gets the alternatives names of a checksum or hash algorithm from its identifier.
Definition: ckfactory.cpp:667
static Checksum * getNewInstance(const ChecksumAlgoId id)
Gives a pointer on a new instance of the specified checksum or hash identifier.
Definition: ckfactory.cpp:282
static bool getAlgorithmId(ChecksumAlgoId &id, const std::string &name, const bool lookInAltNames=true)
Gets the identifier of a checksum or hash algorithm from its name.
Definition: ckfactory.cpp:518
static void cleanUp()
Cleans-up the static members of the class.
Definition: ckfactory.cpp:263
static int getAlgorithmsCount()
Returns the number of available checksum or hash algorithms.
Definition: ckfactory.cpp:500
static bool getAlgorithmName(std::string &name, const ChecksumAlgoId id)
Gets the name of a checksum or hash algorithm from its identifier.
Definition: ckfactory.cpp:617
static std::string getAlgorithmDescription(const ChecksumAlgoId id)
Returns the description of a checksum or hash algorithm from its identifier.
Definition: ckfactory.cpp:726
static bool getAlgorithmIdNoCase(ChecksumAlgoId &id, const std::string &name, const bool lookInAltNames=true)
Gets the identifier of a checksum or hash algorithm from its name with no case comparison.
Definition: ckfactory.cpp:569
static bool exists(const ChecksumAlgoId id)
Returns true if the given identifier of the checksum or hash algorithm exists.
Definition: ckfactory.cpp:409
static void initialise()
Initializes the static members of the class.
Definition: ckfactory.cpp:183
Stores the value of a checksum.
Definition: ckvalue.hpp:45
void setValue(const uint8_t *value, const size_t size, const ChecksumAlgoId type)
Sets the value of the checksum.
Definition: ckvalue.cpp:305
Computes a checksum from a byte stream.
Definition: checksum.hpp:54
static ArrayString getAlternativeNames()
Returns the alternative name(s) of the checksum or the hash algorithm.
Definition: checksum.hpp:137
virtual ChecksumAlgoId getID() const =0
Returns an unique identifier for the checksum or the hash algorithm.
virtual size_t getSize() const =0
Returns the minimal size to allocate in memory to store the checksum with the getValue(buffer) metho...
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: md2.hpp:141
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: md2.hpp:155
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: md2.hpp:168
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: md4.hpp:167
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: md4.hpp:180
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: md4.hpp:153
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: md5.hpp:154
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: md5.hpp:168
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: md5.hpp:181
static ArrayString getAlternativeNames()
Returns the alternative names of the RIPE-MD160 hash algorithm.
Definition: rmd160.cpp:501
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: rmd160.hpp:154
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: rmd160.hpp:178
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: rmd160.hpp:198
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: sha1.hpp:164
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA1 hash algorithm.
Definition: sha1.cpp:380
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: sha1.hpp:185
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: sha1.hpp:198
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: sha224_256.hpp:187
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: sha224_256.hpp:221
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA224 hash algorithm.
Definition: sha224_256.cpp:341
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: sha224_256.hpp:208
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: sha224_256.hpp:343
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: sha224_256.hpp:356
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: sha224_256.hpp:322
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA256 hash algorithm.
Definition: sha224_256.cpp:400
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: sha384_512.hpp:208
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: sha384_512.hpp:221
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA384 hash algorithm.
Definition: sha384_512.cpp:377
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: sha384_512.hpp:187
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: keccak.hpp:221
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA3-224 hash algorithm.
Definition: keccak.cpp:275
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: keccak.hpp:200
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: keccak.hpp:234
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: keccak.hpp:329
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA3-256 hash algorithm.
Definition: keccak.cpp:305
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: keccak.hpp:363
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: keccak.hpp:350
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: keccak.hpp:492
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: keccak.hpp:479
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA3-384 hash algorithm.
Definition: keccak.cpp:335
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: keccak.hpp:458
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: keccak.hpp:621
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: keccak.hpp:587
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA3-512 hash algorithm.
Definition: keccak.cpp:365
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: keccak.hpp:608
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: sha384_512.hpp:344
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: sha384_512.hpp:357
static ArrayString getAlternativeNames()
Returns the alternative names of the SHA512 hash algorithm.
Definition: sha384_512.cpp:438
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: sha384_512.hpp:323
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: sm3.hpp:200
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: sm3.hpp:186
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: sm3.hpp:213
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: tiger.hpp:221
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: tiger.hpp:194
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: tiger.hpp:208
static constexpr ChecksumAlgoId getIdentifier()
Returns an unique identifier for the hash algorithm.
Definition: whirlpool.hpp:188
static std::string getHashName()
Returns the name of the hash algorithm.
Definition: whirlpool.hpp:174
static Checksum * getNewInstance()
Gets a new instance of this class.
Definition: whirlpool.hpp:201
Compute crc32.
Compute crc64.
Common definitions for libxcks.
constexpr const char * libxcks_domain
Domain for translations (i18n).
Definition: defs.hpp:47
Compute Keccak and SHA3 hashes.
Compute md2 hash.
Compute md4 hash.
Compute md5 hash.
Compute ripe-md160 hash.
Compute sha1 hash.
Compute sha224 hash and sha256 hash.
Compute sha384 hash and sha512 hash.
Compute SM3 hash.
bool stringICompare(const std::string &str1, const std::string &str2)
Case-insensitive comparison of two strings.
Definition: strutil.cpp:191
String utilities.
Compute Tiger hash.
std::vector< ChecksumAlgoId > ArrayChecksumAlgoId
Array of ids of algorithms of checksums.
Definition: types.hpp:92
ChecksumAlgoId
Ids of algorithms of checksums.
Definition: types.hpp:65
std::vector< std::string > ArrayString
Array of strings.
Definition: types.hpp:44
Compute Whirlpool hash.