Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Cryptography
  3. bcrypt-ruby

bcrypt-ruby

NOASSERTIONCv3.1.22

A Ruby binding for the OpenBSD bcrypt() password hashing algorithm to securely store user passwords.

GitHubGitHub
2.0k stars293 forks0 contributors

What is bcrypt-ruby?

bcrypt-ruby is a Ruby binding for the OpenBSD bcrypt() password hashing algorithm that enables secure storage of user passwords in Ruby applications. It solves the critical security problem of protecting passwords in databases by making password cracking computationally expensive through adaptive hashing. The library automatically handles salt generation and provides adjustable cost factors to maintain security as hardware improves.

Target Audience

Ruby and Rails developers building applications that require secure user authentication and password storage. This includes web developers, security-conscious application builders, and anyone implementing user management systems in Ruby.

Value Proposition

Developers choose bcrypt-ruby because it implements the industry-standard bcrypt algorithm specifically designed for password protection, provides automatic salt handling to prevent rainbow table attacks, and offers adjustable cost factors to future-proof security. It's the default password hashing implementation in Rails and is battle-tested in production environments.

Overview

bcrypt-ruby is a Ruby binding for the OpenBSD bcrypt() password hashing algorithm, allowing you to easily store a secure hash of your users' passwords.

Use Cases

Best For

  • Securing user passwords in Ruby on Rails applications
  • Implementing secure authentication systems in Ruby
  • Protecting against password database breaches
  • Future-proofing password security with adjustable cost factors
  • Adding bcrypt password hashing to legacy Ruby applications
  • Building applications that require compliance with security best practices

Not Ideal For

  • Applications with stringent performance requirements where bcrypt's computational cost is prohibitive, such as high-traffic APIs with stateless authentication.
  • Projects that require support for modern password hashing algorithms like Argon2, which bcrypt-ruby does not implement.
  • Environments needing built-in password policy enforcement or complexity rules beyond basic hashing.

Pros & Cons

Pros

Industry-Standard Security

Implements the bcrypt algorithm specifically designed for password protection, making password cracking computationally expensive and resistant to rainbow table attacks.

Adjustable Cost Factor

Allows developers to increase the work factor over time to maintain security as hardware improves, with a default cost of 12 that can be customized.

Automatic Salt Management

Handles salt generation and storage transparently, eliminating common implementation errors and ensuring each hash is unique.

Seamless Rails Integration

Integrates directly with Rails through ActiveModel::SecurePassword, making it easy for developers to add secure password hashing to their applications.

Cons

Performance Overhead

Bcrypt is intentionally slow to resist brute-force attacks, which can increase server load and response times, especially in stateless authentication scenarios, as noted in the README.

Limited Algorithm Support

Only supports the bcrypt algorithm, missing newer options like Argon2 that might offer better security properties in some contexts, limiting flexibility.

Native Extension Dependency

Requires compilation of native extensions on some platforms, which can complicate installation and deployment compared to pure-Ruby solutions.

Frequently Asked Questions

Quick Stats

Stars1,994
Forks293
Contributors0
Open Issues16
Last commit4 months ago
CreatedSince 2008

Tags

#authentication#bcrypt#ruby-gem#rails-integration#cryptography#password-security

Built With

R
Ruby
C
C++

Included in

Ruby14.1kCryptography6.8k
Auto-fetched 1 day ago

Related Projects

ThemisThemis

Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Stars1,977
Forks159
Last commit6 months ago
RbNaClRbNaCl

Ruby FFI binding to the Networking and Cryptography (NaCl) library (a.k.a. libsodium)

Stars984
Forks95
Last commit1 year ago
SymSym

Sym is a command line utility and a Ruby API that makes it trivial to encrypt and decrypt sensitive data. Unlike many other existing encryption tools, sym focuses on usability and streamlined interface (CLI), with the goal of making encryption easy and transparent. The result? There is no excuse for keeping your application secrets unencrypted :)

Stars139
Forks9
Last commit3 years ago
Symmetric EncryptionSymmetric Encryption

Transparently encrypt ActiveRecord, Mongoid, and MongoMapper attributes. Encrypt passwords in configuration files. Encrypt entire files at rest

Stars0
Forks0
Last commit
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub