Arcane  v3.16.0.0
Documentation utilisateur
Chargement...
Recherche...
Aucune correspondance
SHA1HashAlgorithm.h
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/* SHA1HashAlgorithm.h (C) 2000-2023 */
9/* */
10/* Calcule la fonction de hashage SHA-1. */
11/*---------------------------------------------------------------------------*/
12#ifndef ARCANE_UTILS_SHA1HASHALGORITHM_H
13#define ARCANE_UTILS_SHA1HASHALGORITHM_H
14/*---------------------------------------------------------------------------*/
15/*---------------------------------------------------------------------------*/
16
17#include "arcane/utils/IHashAlgorithm.h"
18#include "arcane/utils/String.h"
19
20/*---------------------------------------------------------------------------*/
21/*---------------------------------------------------------------------------*/
22
23namespace Arcane::SHA1Algorithm
24{
25class SHA1;
26}
27
28namespace Arcane
29{
30
31/*---------------------------------------------------------------------------*/
32/*---------------------------------------------------------------------------*/
33/*!
34 * \brief Implémentation de l'algorithme SHA-1.
35 */
36class ARCANE_UTILS_EXPORT SHA1HashAlgorithm
37: public IHashAlgorithm
38{
39 public:
40
41 void computeHash(Span<const std::byte> input, HashAlgorithmValue& value) override;
42 void computeHash(ByteConstArrayView input, ByteArray& output) override;
43 void computeHash64(Span<const Byte> input, ByteArray& output) override;
44 void computeHash64(Span<const std::byte> input, ByteArray& output) override;
45 String name() const override { return "SHA1"; }
46 Int32 hashSize() const override { return 20; }
47 Ref<IHashAlgorithmContext> createContext() override;
48 bool hasCreateContext() const override { return true; }
49
50 private:
51
52 void _computeHash64(Span<const std::byte> input, ByteArray& output);
53 void _computeHash(Span<const std::byte> input, HashAlgorithmValue& value);
54};
55
56/*---------------------------------------------------------------------------*/
57/*---------------------------------------------------------------------------*/
58
59} // namespace Arcane
60
61/*---------------------------------------------------------------------------*/
62/*---------------------------------------------------------------------------*/
63
64#endif
Valeur retournée par un algorithme de hashage.
Interface d'un algorithme de hashage.
Référence à une instance.
Implémentation de l'algorithme SHA-1.
Int32 hashSize() const override
Taille (en octet) de la clé de hash.
void computeHash64(Span< const Byte > input, ByteArray &output) override
Calcule la valeur du hash pour le tableau input.
bool hasCreateContext() const override
Indique si l'implémentation supporte un hash incrémental.
String name() const override
Nom de l'algorithme.
void computeHash(Span< const std::byte > input, HashAlgorithmValue &value) override
Calcule la valeur du hash pour le tableau input.
Vue d'un tableau d'éléments de type T.
Definition Span.h:513
Chaîne de caractères unicode.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Array< Byte > ByteArray
Tableau dynamique à une dimension de caractères.
Definition UtilsTypes.h:208
ConstArrayView< Byte > ByteConstArrayView
Equivalent C d'un tableau à une dimension de caractères.
Definition UtilsTypes.h:563
std::int32_t Int32
Type entier signé sur 32 bits.