搜尋套件、儲存庫與 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)}');
}

所屬分類

原始碼儲存庫

使用此套件的專案