encrypt_mapping#
- scikitplot.cleanprompt.encrypt_mapping(mapping, key)[source]#
Encrypt every value of
mapping, leaving the labels in the clear.- Parameters:
- mappingmapping of str to str
Label-to-secret pairs.
- keybytes
A Fernet key.
- Returns:
- dict of str to str
The same labels, mapped to base64 ciphertext.
- Raises:
- CapabilityError
If the
cryptotier is unavailable.- CleanPromptError
If the key is malformed.
- Parameters:
- Return type:
Examples
>>> key = new_key().encode() >>> box = encrypt_mapping({"[EMAIL-1]": "a@b.co"}, key) >>> decrypt_mapping(box, key) {'[EMAIL-1]': 'a@b.co'}