搜索插件、代码仓与 APP 分类

插件详情v2.0.0

dbcrypt

jBCrypt 到 Dart 的移植版本。它允许使用可配置的工作因子对密码进行 BCrypt 加密,并验证密码。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1.8万
喜欢数
47
Pub 分数
140

安装插件

flutter pub add dbcrypt

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

dbcrypt 是 jBCrypt 的 Dart 实现,使用 BCrypt 算法提供安全的密码哈希。它支持可配置的工作因子,以在安全性和性能之间取得平衡,从而实现密码的安全存储。该包允许用户在注册时哈希密码,并在身份验证时验证密码。专为跨平台使用而设计,可在 Android、iOS、Web、macOS、Windows 和 Linux 上无缝运行。适用于需要强大密码保护且设置简单的应用程序。

适合场景

  • 安全密码存储
  • 用户身份验证
  • Web 应用中的密码哈希
  • 跨平台应用安全
  • API 后端密码验证
  • 移动应用登录系统

主要特点

  • BCrypt 密码哈希
  • 可配置的工作因子
  • 跨平台兼容性
  • 简单的哈希和验证 API
  • 开源且持续维护
  • 支持所有主要平台

适合对象

  • 需要安全认证的网页和移动应用
  • 处理用户凭据的后端服务
  • 需要符合安全标准的应用程序
  • 使用 Dart 进行安全密码管理的开发者
  • 优先考虑密码学最佳实践的项目

使用建议

  • 需要仔细选择工作因子以平衡性能与安全
  • 不适合用于加密密码以外的敏感数据
  • 依赖外部库的稳定性
  • 仅限与密码相关的使用场景
  • 无内置盐管理(内部处理)

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

DBCrypt

Port of jBCrypt to Dart.

This system hashes passwords using a version of Bruce Schneier's Blowfish block cipher with modifications designed to raise the cost of off-line password cracking. The computation cost of the algorithm is parameterised, so it can be increased as computers and Dart VM get faster.

Build Status

Installation

Add to your pubspec.yaml the following:

dependencies:
  dbcrypt: ^2.0.0

Usage

Hashing a password is easy:

import 'package:dbcrypt/dbcrypt.dart'

main() {
  var plainPassword = "P@55w0rd";
  var hashedPassword = new DBCrypt().hashpw(plainPassword, new DBCrypt().gensalt());
}

Comparing a plain and a hashed password is even easier:

var isCorrect = new DBCrypt().checkpw(plain, hashed);

Running Tests

Dependencies are installed using the Pub Package Manager.

# For running the tests it needs the 'dart' executable on your path. 
# Execute the next command if it isn't already on your path:
export DART_SDK=path/to/dart/sdk

pub install

test/run.sh

所属分类

源码仓库

使用此插件的项目

暂无相关数据。