Discussion:
[dart-misc] In dart how to decrypt of the encrypted value?
Niyazi Toros
2018-07-03 11:48:00 UTC
Permalink
I am testing the Cryptographic hashing functions for Dart. I can't find
any information about DECRYPTION?

Can anyone show me how to decryption of the encrypted value?


And this is example;


import 'dart:convert';
import 'package:crypto/crypto.dart';

void main() async {
var key = utf8.encode('***@ssw0rd');
var bytes = utf8.encode("Dart and Aqueduct makes my life easier. Thank
you.");


// TODO: ENCRYPTION
var hmacSha256 = new Hmac(sha256, key); // HMAC-SHA256
var digest = hmacSha256.convert(bytes);

print(“————ENCRYPTION—————“);
print("HMAC digest as bytes: ${digest.bytes}");
print("HMAC digest as hex string: $digest");
print('\r\n');




// TODO: DECRYPTION

????????????
print(“————DECRYPTION—————“);
print(?????????);

}
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/0695244d-6df1-415c-9225-7c7fd26a9d12%40dartlang.org.
Istvan Soos
2018-07-03 13:31:28 UTC
Permalink
Hi Niyazi,

HMAC is not an encryption format that you can encrypt and decrypt, it
is a one-way hash function that can be used to check the integrity of
a message. You can only calculate the hash of a given message, but not
decrypt the message from the hash.

The wikipedia page explains it in more detail than I possibly can:
https://en.wikipedia.org/wiki/HMAC

package:crypto deals with hashes, it does not cover other types of cryptography.

Cheers,
Istvan
I am testing the Cryptographic hashing functions for Dart. I can't find any
information about DECRYPTION?
Can anyone show me how to decryption of the encrypted value?
And this is example;
import 'dart:convert';
import 'package:crypto/crypto.dart';
void main() async {
var bytes = utf8.encode("Dart and Aqueduct makes my life easier. Thank
you.");
// TODO: ENCRYPTION
var hmacSha256 = new Hmac(sha256, key); // HMAC-SHA256
var digest = hmacSha256.convert(bytes);
print(“————ENCRYPTION—————“);
print("HMAC digest as bytes: ${digest.bytes}");
print("HMAC digest as hex string: $digest");
print('\r\n');
// TODO: DECRYPTION
????????????
print(“————DECRYPTION—————“);
print(?????????);
}
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups
"Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an
To view this discussion on the web visit
https://groups.google.com/a/dartlang.org/d/msgid/misc/0695244d-6df1-415c-9225-7c7fd26a9d12%40dartlang.org.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CALdQGgsVX0VEB7uKAmxcucqf5my4Wk4u4rbLHnZb35E_D4c2CQ%40mail.gmail.com.
Niyazi Toros
2018-07-03 13:41:10 UTC
Permalink
Thanks Istvan, there is a Chiper plugin but its to old and dint pass any
documentation. I am looking something that encrypt string and than decrypt.
In C# I do similar project but I am trying to find same in Dart.
--
For more ways to connect visit https://www.dartlang.org/community
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/6c8a7e8b-4259-41b1-8e97-d333a4942cd4%40dartlang.org.
Loading...