fargon2 1.0.1 copy "fargon2: ^1.0.1" to clipboard
fargon2: ^1.0.1 copied to clipboard

A plugin for generating a hash based on Argon2 algorithm in Android / iOS platform.

example/lib/main.dart

import 'dart:async';

import 'package:fargon2/fargon2.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key}) : super();

  @override
  createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _argon2idHash = '';

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    try {
      final hash = await const Fargon2(mode: Fargon2Mode.argon2id).hash(
        passphrase: 'mypassphrase',
        salt: 'mysalt01',
        hashLength: 16,
      );
      if (mounted) {
        setState(() {
          _argon2idHash = hash;
        });
      }
    } catch (e) {
      _argon2idHash = e.toString();
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('hash: $_argon2idHash'),
        ),
      ),
    );
  }
}
4
likes
150
points
30
downloads

Publisher

verified publisheriktakahiro.dev

Weekly Downloads

A plugin for generating a hash based on Argon2 algorithm in Android / iOS platform.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on fargon2