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

插件详情v1.0.2

dart_des

此算法是 DES 和三重 DES 算法的纯 Dart 实现。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
1.7万
喜欢数
31
Pub 分数
150

安装插件

flutter pub add dart_des

插件介绍

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

dart_des 是数据加密标准(DES)和三重 DES 加密算法的纯 Dart 实现。它提供了安全、平台无关的加密操作,适用于需要对称密钥加密的应用程序。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,非常适合需要传统或标准化加密的跨平台应用程序。它不依赖原生代码,确保在各种环境中的行为一致。该库专为需要实现基于 DES 的加密且无需外部依赖的开发者设计。

适合场景

  • 旧系统集成
  • 安全数据传输
  • 离线应用中的数据保护
  • 符合DES标准
  • 与基于DES的服务的互操作性

主要特点

  • 纯 Dart 实现
  • 支持 DES 和三重 DES
  • 跨平台兼容性
  • 无原生依赖
  • 用于加密/解密的简单 API

适合对象

  • 需要DES加密的开发人员
  • 需要向后兼容的应用程序
  • 项目避免原生代码
  • 注重安全的Flutter应用程序
  • 使用标准DES算法的系统

使用建议

  • DES被认为在高安全性需求方面已过时
  • 三重DES比现代替代方案慢
  • 不推荐用于新的高安全性项目
  • 需要谨慎管理密钥
  • 限于对称密钥加密

原始 README

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

dart_des

This algorithm is a pure dart implementation of the DES and Triple DES algorithms (port of pyDES). Triple DES is either DES-EDE3 with a 24 byte key, or DES-EDE2 with a 16 byte key.

Example
import 'dart:convert';

import 'package:convert/convert.dart';
import 'package:dart_des/dart_des.dart';

main() {
  String key = '12345678'; // 8-byte
  String message = 'Driving in from the edge of town';
  List<int> encrypted;
  List<int> decrypted;
  List<int> iv = [1, 2, 3, 4, 5, 6, 7, 8];

  print('key: $key');
  print('message: $message');

  DES desECB = DES(key: key.codeUnits, mode: DESMode.ECB);
  encrypted = desECB.encrypt(message.codeUnits);
  decrypted = desECB.decrypt(encrypted);
  print('DES mode: ECB');
  print('encrypted: $encrypted');
  print('encrypted (hex): ${hex.encode(encrypted)}');
  print('encrypted (base64): ${base64.encode(encrypted)}');
  print('decrypted: $decrypted');
  print('decrypted (hex): ${hex.encode(decrypted)}');
  print('decrypted (utf8): ${utf8.decode(decrypted)}');

  key = '123456781234567812345678'; // 24-byte
  DES3 des3CBC = DES3(key: key.codeUnits, mode: DESMode.CBC, iv: iv);
  encrypted = des3CBC.encrypt(message.codeUnits);
  decrypted = des3CBC.decrypt(encrypted);
  print('Triple DES mode: CBC');
  print('encrypted: $encrypted');
  print('encrypted (hex): ${hex.encode(encrypted)}');
  print('encrypted (base64): ${base64.encode(encrypted)}');
  print('decrypted: $decrypted');
  print('decrypted (hex): ${hex.encode(decrypted)}');
  print('decrypted (utf8): ${utf8.decode(decrypted)}');
}

所属分类

源码仓库

使用此插件的项目