
Developer almost hashed KYC document
Original: I Almost Hashed a Document Number That Needed to Be Read Again
Short summary
When building KYC verification, the author initially planned to hash document numbers—a secure pattern for passwords. But verification requires reading the original number back (does "1234 5678" match the physical Aadhaar?), and hashing is irreversible. Solution: encrypt with AES-256-GCM for authenticated encryption that detects tampering, store the key separately, and log every admin decryption unconditionally. The lesson: encryption answers "what is the original value," hashing answers "is this the same," and audit logging protects data from authorized users.
- •Hashing is for "is this the same?" (passwords), encryption is for "what is the original?" (KYC documents)
- •AES-256-GCM provides authenticated encryption that detects tampering; store the key separately from the database
- •Audit logging every admin access is as important as encryption to prevent unauthorized use by authorized users
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



