Password Hashing with PBKDF2 in C# (ASP.NET) and Ruby on Rails
The article presents complete, licensed implementations of salted PBKDF2‑SHA1 password hashing for both ASP.NET (C#) and Ruby on Rails, detailing the source code, usage methods, and verification procedures to securely store and validate passwords.
This article provides implementations of salted password hashing using PBKDF2‑SHA1 for both ASP.NET (C#) and Ruby on Rails, including full source code, licensing information, and usage examples.
In C#, the PasswordHash class defines constants for salt size, hash size, and iteration count, and offers CreateHash and ValidatePassword methods that generate a hash string formatted as iterations:salt:hash and verify passwords securely.
The Ruby module PasswordHash mirrors the same functionality, defining comparable constants and providing createHash and validatePassword methods that produce and check hashes using OpenSSL's PBKDF2‑HMAC‑SHA1, with a self‑test routine to confirm correctness.
Both implementations include the original BSD‑style license and attribution to the original author and source (crackstation.net).
Architect
Professional architect sharing high‑quality architecture insights. Topics include high‑availability, high‑performance, high‑stability architectures, big data, machine learning, Java, system and distributed architecture, AI, and practical large‑scale architecture case studies. Open to ideas‑driven architects who enjoy sharing and learning.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.