Skip to content
pubscout

pinenacl

0.6.0, released 2 years ago by poolunder.com

Dart implementation of TweetNaCl cryptographic library with high-level APIs

WASM-readySingle maintainer
$ flutter pub add pinenacl
Source repository

What it does

Provides authenticated encryption, digital signatures, hashing, and key derivation using Curve25519 and Ed25519. It wraps TweetNaCl functions into Dart-friendly classes and methods.

AI-written summary of version 0.6.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need fast, auditable cryptography in a pure Dart app
  • Implementing secure messaging or key exchange
  • Generating and verifying Ed25519 signatures
  • Deriving keys from passwords with PBKDF2

Skip it when

  • You need platform-specific native crypto APIs for performance
  • You require integration with existing native libraries like OpenSSL

Strengths

  • Pure Dart, no native dependencies
  • Supports multiple cryptographic primitives (Box, SealedBox, SecretBox, Ed25519, HMAC, SHA-256/512, BLAKE2b)
  • Well-documented API mirroring PyNaCl
  • Cross-platform (android, ios, web, windows, macos, linux)

Weaknesses

  • No native acceleration, may be slower than platform libs
  • Large feature set may be overkill for simple use cases
  • No built-in key storage or secure enclave integration

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0

Add dependency in pubspec and import package:pinenacl/api.dart

import 'package:pinenacl/api.dart';

final keyPair = await KeyPair.generate();
final box = Box(keyPair.publicKey, keyPair.privateKey);
final ciphertext = box.encrypt('hello');
final plaintext = box.decrypt(ciphertext);

Alternatives

Packages that do the same job and could replace pinenacl.

  • crypto

    Provides SHA, MD5, and HMAC hashing functions for Dart.

  • crypto_keys

    Library for signing, verifying, encrypting and decrypting using pointycastle.

  • cryptography_plus

    Cryptographic algorithms for encryption, signatures, key agreement, and hashing across platforms.

  • cryptography

    Cross‑platform cryptographic algorithms for Dart and Flutter.

Works with

Packages commonly used together with pinenacl: ones it builds on, ones built on it, and its own family.