Arcane  v3.16.0.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
HashAlgorithmServices.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* HashAlgorithmServices.h (C) 2000-2023 */
9/* */
10/* Services de calcul de Hashs. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/utils/IOException.h"
15#include "arcane/utils/Array.h"
16#include "arcane/utils/TraceInfo.h"
17#include "arcane/utils/SHA3HashAlgorithm.h"
18#include "arcane/utils/SHA1HashAlgorithm.h"
19#include "arcane/utils/MD5HashAlgorithm.h"
20
21#include "arcane/core/AbstractService.h"
22#include "arcane/core/ServiceBuildInfo.h"
24
25/*---------------------------------------------------------------------------*/
26/*---------------------------------------------------------------------------*/
27
28namespace Arcane
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33
34template <typename HashAlgoImplementation>
35class GenericHashAlgorithmService
36: public AbstractService
37, public HashAlgoImplementation
38{
39 public:
40
41 explicit GenericHashAlgorithmService(const ServiceBuildInfo& sbi)
42 : AbstractService(sbi)
43 , m_name(sbi.serviceInfo()->localName())
44 {
45 }
46
47 public:
48
49 String name() const override { return m_name; }
50
51 private:
52
53 String m_name;
54};
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
59using SHA3_256HashAlgorithmService = GenericHashAlgorithmService<SHA3_256HashAlgorithm>;
60using SHA3_224HashAlgorithmService = GenericHashAlgorithmService<SHA3_224HashAlgorithm>;
61using SHA3_384HashAlgorithmService = GenericHashAlgorithmService<SHA3_384HashAlgorithm>;
62using SHA3_512HashAlgorithmService = GenericHashAlgorithmService<SHA3_512HashAlgorithm>;
63using MD5HashAlgorithmService = GenericHashAlgorithmService<MD5HashAlgorithm>;
64using SHA1HashAlgorithmService = GenericHashAlgorithmService<SHA1HashAlgorithm>;
65
66ARCANE_REGISTER_SERVICE(SHA3_256HashAlgorithmService,
67 ServiceProperty("SHA3_256HashAlgorithm", ST_Application | ST_CaseOption),
69
70ARCANE_REGISTER_SERVICE(SHA3_224HashAlgorithmService,
71 ServiceProperty("SHA3_224HashAlgorithm", ST_Application | ST_CaseOption),
73
74ARCANE_REGISTER_SERVICE(SHA3_384HashAlgorithmService,
75 ServiceProperty("SHA3_384HashAlgorithm", ST_Application | ST_CaseOption),
77
78ARCANE_REGISTER_SERVICE(SHA3_512HashAlgorithmService,
79 ServiceProperty("SHA3_512HashAlgorithm", ST_Application | ST_CaseOption),
81
82ARCANE_REGISTER_SERVICE(MD5HashAlgorithmService,
83 ServiceProperty("MD5HashAlgorithm", ST_Application | ST_CaseOption),
85
86ARCANE_REGISTER_SERVICE(SHA1HashAlgorithmService,
87 ServiceProperty("SHA1HashAlgorithm", ST_Application | ST_CaseOption),
89
90/*---------------------------------------------------------------------------*/
91/*---------------------------------------------------------------------------*/
92
93} // End namespace Arcane
94
95/*---------------------------------------------------------------------------*/
96/*---------------------------------------------------------------------------*/
Ce fichier contient les différentes fabriques de services et macro pour enregistrer les services.
#define ARCANE_SERVICE_INTERFACE(ainterface)
Macro pour déclarer une interface lors de l'enregistrement d'un service.
AbstractService(const ServiceBuildInfo &)
Constructeur à partir d'un ServiceBuildInfo.
Interface d'un algorithme de hashage.
virtual String localName() const =0
Partie locale du nom du service.
Structure contenant les informations pour créer un service.
IServiceInfo * serviceInfo() const
Accès au IServiceInfo associé
Propriétés de création d'un service.
Chaîne de caractères unicode.
#define ARCANE_REGISTER_SERVICE(aclass, a_service_property,...)
Macro pour enregistrer un service.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
@ ST_Application
Le service s'utilise au niveau de l'application.
@ ST_CaseOption
Le service s'utilise au niveau du jeu de données.