rsa_crypto_algorithm 0.0.1 copy "rsa_crypto_algorithm: ^0.0.1" to clipboard
rsa_crypto_algorithm: ^0.0.1 copied to clipboard

Plugin to enrypt and decrypt simple data in Dart

rsa_crypto_algorithm #

Plugin or library to do encrypt and decrypt message with RSA Crypto

Usage #

To use this plugin, add rsa_crypto_algorithm as a dependency in your pubspec.yaml.

Example #

import 'dart:io';
import 'package:rsa_crypto_algorithm/rsa_key.dart' as rsaKey;
import 'package:rsa_crypto_algorithm/rsa_crypto.dart' as rsaCrypto;

main() {
  /// Take input from keybowrd
  print("Welcome to RSA Algorithm");
  print("Enter p: ");
  var p = int.parse(stdin.readLineSync());
  print("Enter q: ");
  var q = int.parse(stdin.readLineSync());

  var key = rsaKey.RSAKey();
  var n = key.valueOfN(p, q);
  var z = key.valueOfZ(p, q);
  var e = key.valueOfE(n, z);
  var d = key.valueOfD(n, e, z);
  key.generateKey(n, z, e, d);

  print("\nSelect one:");
  print("1. Encript\n2. Decript");
  var opt = int.parse(stdin.readLineSync());

  var rsa = rsaCrypto.RSACripto();
  if (opt == 1) {
    print("Enter M: ");
    var m = int.parse(stdin.readLineSync());
    var enc = rsa.encrypt(m, e, n);
    print("Encripted success: ${enc}");
  } else {
    print("Enter C: ");
    var c = int.parse(stdin.readLineSync());
    var dec = rsa.decrypt(c, d, n);
    print("Decripted success: ${dec}");
  }
}

I hope this plugin or library will useful for you. Thank you so much! ~ Happy Coding ~

5
likes
20
pub points
0%
popularity

Publisher

unverified uploader

Plugin to enrypt and decrypt simple data in Dart

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

More

Packages that depend on rsa_crypto_algorithm