xor_dart 1.0.0 copy "xor_dart: ^1.0.0" to clipboard
xor_dart: ^1.0.0 copied to clipboard

outdated

Supply XOR symmetric encryption/decryption

Symmetric Cipher XOR #

platform_info

A pure dart XOR cipher library, support encryption and decryption with or without a symmetric secret key.

Usage example #

1. with a secret key
import 'package:xor_dart/xor_dart.dart';

void main() {
  var xor = Xor('_a_random_key_');

  var plain = 'You are so handsome!';
  var encode = xor.encode(plain);
  var decode = xor.decode(encode);

  print('>>>>>>>> plain: $plain, encode: $encode, decode: $decode');
  print('>>>>>>>> decryption result is correct: ${plain == decode}'); // true
}
2. without a secret key
import 'dart:convert';
import 'package:xor_dart/xor_dart.dart';

void main() {
  var content = '1234567890';
  var bytes = utf8.encode(content);

  // To bytes
  var en = CipherXor.encrypt(bytes);
  var de = CipherXor.decrypt(en);
  print('content: $bytes, encrypted: $en, decrypted: $de');

  // To strings
  var encrypted = CipherXor.encryptToBase64(content);
  var decrypted = CipherXor.decryptFromBase64(encrypted);
  print('content: $content, encrypted: $encrypted, decrypted: $decrypted');
}

License #

MIT

Features and bugs #

Please feel free to: request new features and bugs at the issue tracker

9
likes
0
points
111
downloads

Publisher

unverified uploader

Weekly Downloads

Supply XOR symmetric encryption/decryption

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on xor_dart