Can I hash/encrypt or otherwise protect emails in my Django app from hackers?

StackOverflow https://stackoverflow.com/questions/20647081

  •  19-09-2022
  •  | 
  •  

سؤال

Hoping for a simple function I can use to store emails securely and retrieve easily when required to send emails.

هل كانت مفيدة؟

المحلول

Kind of a general question, but here are a few solutions I'm familiar with:

  • use django-encrypted-fields, which has an EncryptedEmailField
  • you can override the save method for encrypting the email yourself, then override the post_init signal for decryption. See example here (which is based on this)
  • you can build your own encrypted email field, see django snippet here (uses pyCrypto)
  • you can use django-extension's EncryptedCharField
  • If none of the above seems good enough, try google-ing around by yourself. You're probably not the first to tackle this problem

good luck.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top