Skip to content

fix: Use PBKDF2 for secure PIN hashing#35

Open
zhifu349-debug wants to merge 3 commits intowindoze95:mainfrom
zhifu349-debug:main
Open

fix: Use PBKDF2 for secure PIN hashing#35
zhifu349-debug wants to merge 3 commits intowindoze95:mainfrom
zhifu349-debug:main

Conversation

@zhifu349-debug
Copy link

Summary

Fix insecure PIN hashing using unsalted SHA-256 (issue #20).

Changes

Replace fast unsalted SHA-256 with PBKDF2-HMAC-SHA256:

  • Use random 32-byte salt per PIN
  • Apply 100,000 iterations for secure key derivation
  • Store salt+hash together (base64 encoded)
  • Add verification function that extracts salt from stored hash

Security Improvement

Before After
SHA-256 (no salt) PBKDF2-HMAC-SHA256
Instant rainbow table attack ~100ms per hash
No salt Unique random salt per PIN

Testing

Existing PIN functionality should continue to work. New PINs will use the secure hashing scheme.

Fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant