Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UTF8 support #19

Closed
boapps opened this issue Jan 27, 2019 · 1 comment
Closed

UTF8 support #19

boapps opened this issue Jan 27, 2019 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@boapps
Copy link

boapps commented Jan 27, 2019

I think it messes up some special characters such as 'ő'.

Here is some of my code:

get encrypter async => new Encrypter(new AES(await key));

Future<String> doEncrypt(String text) async {
  Encrypted encrypted = (await encrypter).encrypt(text);
  return encrypted.base64;
}

Future<String> doDecrypt(String text) async {
  try {
    Encrypted encrypted = Encrypted(base64.decode(text));
    return (await encrypter).decrypt(encrypted).toString();
  } catch (e) {
    return "";
  }
}

Or here is a full example with the demo code:
import 'package:encrypt/encrypt.dart';

void main() {
  final key = 'my 32 length key................';
  final encrypter = Encrypter(AES(key));
  final plainText = 'őőőőő ípsum dolor sit amet, consectetur adipiscing elit';

  final encrypted = encrypter.encrypt(plainText);
  final decrypted = encrypter.decrypt(encrypted);

  print(decrypted);
}
@leocavalcante leocavalcante self-assigned this Jan 27, 2019
@leocavalcante leocavalcante added the bug Something isn't working label Jan 27, 2019
@leocavalcante leocavalcante added this to the v2.0 milestone Jan 27, 2019
@leocavalcante
Copy link
Owner

Sorry about that.
Can you refetch v2.0 an try again, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants