

Les traductions sont fournies par des outils de traduction automatique. En cas de conflit entre le contenu d'une traduction et celui de la version originale en anglais, la version anglaise prévaudra.

# CryptographicHash classe
<a name="aws-glue-api-pyspark-transforms-CryptographicHash"></a>

 La transformation `CryptographicHash` applique un algorithme aux valeurs de hachage de la colonne. 

## Exemple
<a name="pyspark-CryptographicHash-examples"></a>

```
from pyspark.context import SparkContext
from pyspark.sql import SparkSession
from awsgluedi.transforms import *

secret = "${SECRET}"
sc = SparkContext()
spark = SparkSession(sc)

input_df = spark.createDataFrame(
    [
        (1, "1234560000"),
        (2, "1234560001"),
        (3, "1234560002"),
        (4, "1234560003"),
        (5, "1234560004"),
        (6, "1234560005"),
        (7, "1234560006"),
        (8, "1234560007"),
        (9, "1234560008"),
        (10, "1234560009"),
    ],
    ["id", "phone"],
)

try:
    df_output = pii.CryptographicHash.apply(
        data_frame=input_df,
        spark_context=sc,
        source_columns=["id", "phone"],
        secret_id=secret,
        algorithm="HMAC_SHA256",
        output_format="BASE64",
    )
    df_output.show()
except:
    print("Unexpected Error happened ")
    raise
```

## Output
<a name="pyspark-CryptographicHash-output"></a>

Le résultat sera :

```
```
+---+------------+-------------------+-------------------+
| id| phone | id_hashed | phone_hashed |
+---+------------+-------------------+-------------------+
| 1| 1234560000 | QUI1zXTJiXmfIb... | juDBAmiRnnO3g... |
| 2| 1234560001 | ZAUWiZ3dVTzCo... | vC8lgUqBVDMNQ... |
| 3| 1234560002 | ZP4VvZWkqYifu... | Kl3QAkgswYpzB... |
| 4| 1234560003 | 3u8vO3wQ8EQfj... | CPBzK1P8PZZkV... |
| 5| 1234560004 | eWkQJk4zAOIzx... | aLf7+mHcXqbLs... |
| 6| 1234560005 | xtI9fZCJZCvsa... | dy2DFgdYWmr0p... |
| 7| 1234560006 | iW9hew7jnHuOf... | wwfGMCOEv6oOv... |
| 8| 1234560007 | H9V1pqvgkFhfS... | g9WKhagIXy9ht... |
| 9| 1234560008 | xDhEuHaxAUbU5... | b3uQLKPY+Q5vU... |
| 10| 1234560009 | GRN6nFXkxk349... | VJdsKt8VbxBbt... |
+---+------------+-------------------+-------------------+
```
```

 La transformation calcule les hachages cryptographiques des valeurs des colonnes `id` et `phone` à l’aide de l’algorithme et de la clé secrète spécifiés, et code les hachages au format Base64. Le `df\$1output` qui en résulte DataFrame contient toutes les colonnes du `input\$1df` original, plus les colonnes supplémentaires `id\$1hashed` et `phone\$1hashed` avec DataFrame les hachages calculés. 

## Méthodes
<a name="aws-glue-api-pyspark-transforms-CryptographicHash-_methods"></a>
+ [\$1\$1call\$1\$1](#aws-glue-api-pyspark-transforms-CryptographicHash-__call__)
+ [s'appliquent](#aws-glue-api-crawler-pyspark-transforms-CryptographicHash-apply)
+ [name](#aws-glue-api-crawler-pyspark-transforms-CryptographicHash-name)
+ [describeArgs](#aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describeArgs)
+ [describeReturn](#aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describeReturn)
+ [describeTransform](#aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describeTransform)
+ [describeErrors](#aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describeErrors)
+ [describe](#aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describe)

## \$1\$1call\$1\$1(spark\$1context, data\$1frame, source\$1columns, secret\$1id, algorithm=None, secret\$1version=None, create\$1secret\$1if\$1missing=False, output\$1format=None, entity\$1type\$1filter=None)
<a name="aws-glue-api-pyspark-transforms-CryptographicHash-__call__"></a>

 La transformation `CryptographicHash` applique un algorithme aux valeurs de hachage de la colonne. 
+ `source_columns` : tableau de colonnes existantes.
+ `secret_id` : ARN de la clé secrète Secrets Manager Clé utilisée dans l’algorithme de préfixe de code d’authentification de message utilisant hash (HMAC) pour hacher les colonnes source.
+ `secret_version` : facultatif. Par défaut, la version du secret la plus récente.
+ `entity_type_filter` : tableau facultatif de types d’entité. Peut être utilisé pour chiffrer uniquement les informations personnelles détectées dans une colonne en texte libre.
+ `create_secret_if_missing` : valeur booléenne facultative. Si la valeur est true, il essaiera de créer le secret au nom de l’appelant.
+ `algorithm` : l’algorithme utilisé pour hacher vos données. Valeurs d'énumération valides : MD5,,, SHA1, HMAC\$1 SHA256 SHA512, HMAC\$1MD5, HMAC\$1, HMAC\$1SHA1. SHA256 SHA512

## apply(cls, \$1args, \$1\$1kwargs)
<a name="aws-glue-api-crawler-pyspark-transforms-CryptographicHash-apply"></a>

Hérité de `GlueTransform` [s'appliquent](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-apply).

## name(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-CryptographicHash-name"></a>

Hérité de `GlueTransform` [name](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-name).

## describeArgs(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describeArgs"></a>

Hérité de `GlueTransform` [describeArgs](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeArgs).

## describeReturn(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describeReturn"></a>

Hérité de `GlueTransform` [describeReturn](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeReturn).

## describeTransform(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describeTransform"></a>

Hérité de `GlueTransform` [describeTransform](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeTransform).

## describeErrors(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describeErrors"></a>

Hérité de `GlueTransform` [describeErrors](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describeErrors).

## describe(cls)
<a name="aws-glue-api-crawler-pyspark-transforms-CryptographicHash-describe"></a>

Hérité de `GlueTransform` [describe](aws-glue-api-crawler-pyspark-transforms-GlueTransform.md#aws-glue-api-crawler-pyspark-transforms-GlueTransform-describe).