搜尋套件、儲存庫與 APP 分類

套件詳情v0.3.2

ed25519_edwards

Go Cryptography ed25519 的 Dart 版本

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
74.2萬
喜歡數
13
Pub 分數
160

安裝套件

flutter pub add ed25519_edwards

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

一種基於 Go 語言加密庫移植的 ed25519 愛德華曲線數位簽章演算法的 Dart 實作。它為加密應用提供安全、高效能的簽名與驗證功能。該套件支援多種平台,包括行動裝置、網頁與桌面,適用於需要強身分驗證與資料完整性之跨平台應用程式。它遵循標準的 ed25519 規範,確保與其他實作的相容性。

適用情境

  • 應用中的安全數位簽章
  • 使用金鑰對進行使用者驗證
  • 訊息的加密驗證
  • 區塊鏈和錢包整合
  • 安全的API通訊

主要特色

  • 跨平台支援
  • 高性能
  • 符合標準的 ed25519 實現
  • 輕便高效
  • 支援金鑰產生、簽名和驗證

適合對象

  • 開發安全應用的開發者
  • 區塊鏈和加密貨幣專案
  • 需要強認證的應用程式
  • 使用 Dart/Flutter 進行後端或前端安全的團隊

使用建議

  • 需要理解密碼學原理
  • 不適合用於原始加密
  • 最佳搭配適當的金鑰管理實務使用
  • 僅限簽名操作,不支援一般加密

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Ed25519

Dart port of ed25519 from Golang ed25519

Pub package

Usage


import 'package:ed25519_edwards/ed25519_edwards.dart' as ed;

    void signAndVerify() {
      var keyPair = ed.generateKey();
      var privateKey = keyPair.privateKey;
      var publicKey = keyPair.publicKey;
      var message = utf8.encode('test message');
      var sig = ed.sign(privateKey, message as Uint8List);
      var result = ed.verify(publicKey, message, sig);
      assert(result == true);
    
      var wrongMessage = utf8.encode('wrong message');
      var wrongResult = ed.verify(publicKey, wrongMessage as Uint8List, sig);
      assert(wrongResult == false);
    }

APIs

Ed25519
public
seed
newKeyFromSeed
generateKey
sign
verify
Edwards25519
FeZero
FeOne
FeAdd
FeSub
FeCopy
FeCMove
FeFromBytes
FeToBytes
FeIsNegative
FeIsNonZero
FeNeg
FeCombine
FeMul
FeSqaure
FeSquare2
FeInvert
GeDoubleScalarMultVartime
PreComputedGroupElementCMove
GeScalarMultBase
ScMulAdd
ScReduce
ScMinimal

Benchmark

Simulate from pinenacl-dart Benchmark

MacBook Pro (16-inch, 2019), macOS Big Sur, with 2.4GHz i9 32GB

JiT (Dart VM) Benchmark

dart test test/benchmark/ed25519_benchmark.dart

type rate iterations time data throughput
Ed25519 - sign 50.54 MB/s 254 iterations 5025 ms 254.00 MB
Ed25519 - verify 97.38 MB/s 487 iterations 5001 ms 487.00 MB
AoT (native binary)

dart2native test/benchmark/ed25519_benchmark.dart -o ed25519_benchmark
./ed25519_benchmark

type rate iterations time data throughput
Ed25519 - sign 21.64 MB/s 109 iterations 5036 ms 109.00 MB
Ed25519 - verify 37.20 MB/s 187 iterations 5027 ms 187.00 MB
JS (Dart2JS) benchmark (too slow, suggest using other libs for dart2js and flutter web)

dart test test/benchmark/ed25519_benchmark.dart -p chrome

type rate iterations time data throughput
Ed25519 - sign 797.03 KB/s 4 iterations 5139 ms 4.00 MB
Ed25519 - verify 1.53 MB/s 8 iterations 5231 ms 8.00 MB

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案