argon2_ffi 0.1.0 copy "argon2_ffi: ^0.1.0" to clipboard
argon2_ffi: ^0.1.0 copied to clipboard

outdated

Argon2 implementation by using ffi as flutter plugin. use argon2_ffi_base for the actual dart code.

example/lib/main.dart

import 'dart:convert';
import 'dart:math';

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

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _argon2ffi = Argon2FfiFlutter();
  final random = Random();

  String result;

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: <Widget>[
            Text('Result: $result\n'),
            RaisedButton(
              child: Text('Do it'),
              onPressed: () {
                int x = random.nextInt(20);
                int y = random.nextInt(20);
                setState(() {
                  result = '$x + $y = ${_argon2ffi.addIt(x, y)} --- ';
                });
              },
            ),
            RaisedButton(
              child: Text('hash stuff'),
              onPressed: () {
                final args = Argon2Arguments(
                  utf8.encode('abc'),
                  utf8.encode('abc'),
                  1024,
                  2,
                  32,
                  2,
                  0,
                  1,
                );
                final hash = _argon2ffi.argon2(args);
                setState(() {
                  result = 'argon2 hash: ${base64.encode(hash)}';
                });
              },
            ),
          ],
        ),
      ),
    );
  }
}
2
likes
30
points
10
downloads

Publisher

verified publishercodeux.design

Weekly Downloads

Argon2 implementation by using ffi as flutter plugin. use argon2_ffi_base for the actual dart code.

Repository (GitHub)

License

unknown (license)

Dependencies

argon2_ffi_base, flutter

More

Packages that depend on argon2_ffi