delletenebre / dart_des Goto Github PK
View Code? Open in Web Editor NEWDart implementation of the DES and Triple DES algorithms
License: MIT License
Dart implementation of the DES and Triple DES algorithms
License: MIT License
when my sourceStr is Chinese, it will be appeard this error。
mycode
`
test("register2", () async {
var map = "猫";
String encryptDart = await EncryptUtil.encryptDartDes(map.toString(), "");
print(encryptDart);
});
static String encryptDartDes(String srcStr, String dateStr) {
String keyStr = "12345678";
final key = keyStr.codeUnits;
final iv = keyStr.codeUnits;
DES desCBC = DES(key: key, mode: DESMode.CBC, iv: iv, paddingType: DESPaddingType.PKCS7);
final encrypted = desCBC.encrypt(srcStr.codeUnits);
return base64.encode(encrypted);
}`
errors:
`
dart:core List.[]
package:dart_des/dart_des.dart 1009:27 DES.xor
package:dart_des/dart_des.dart 1105:19 DES.crypt
package:dart_des/dart_des.dart 1126:7 DES.encrypt
package:project_flutter/utils/encrypt_util.dart 46:30 EncryptUtil.encryptDartDes
test\api_test.dart 40:44 main.
test\api_test.dart 38:21 main.
RangeError (index): Invalid value: Not in inclusive range 0..63: 64
`
String message = 'Driving in from the edge of town';
DES3 des3CBC = DES3(key: 'PDXDzTttJ1F4lgEsoR4xPB9U'.codeUnits, mode: DESMode.CBC, iv: utf8.encode('OoWrs7by'));
final encryptData = des3CBC.encrypt('{"keyword":"hello","page":"1","userToken":""}'.codeUnits);
String encryptString = base64Encode(encryptData);
print(encryptString);
with this code, I get error
@delletenebre
please help me~ thanks so much!!
In the case that I'm working I need to use padding mode but I don't see how to use it in the example code. Can you tell me how to use it if I need to use PKCS7 padding mode?
The DES constructor checks for
if (key.length != 8) {...}
I have a 16 bytes key implementation working well on Delphi and C#. How I can convert my 16 elements array of bytes to an acceptable key?
Hi guys,
I can decrypt the message but it always has some strange characters at the end such as ��
I have function like this:
Future<String> decryptTDES(String data, String password) async {
List<int> iv = [0, 0, 0, 0, 0, 0, 0, 0];
List<int> decrypted;
DES3 des3CBC = DES3(key: md5.convert(utf8.encode(password)).bytes, mode: DESMode.CBC, iv: iv);
decrypted = des3CBC.decrypt(base64.decode(data));
return utf8.decode(decrypted);
}
And it also takes so long time (~30-45s) to decrypt a message 1200 characters (base64 format)
Can someone help me?
hi sir,
I'am working on a project that phone communicate with stm32 MCU by bluetooth(BLE) ,
I encrypted byte arrays with dart_des 0.0.2 , it encrypted 8bytes data and got 8bytes encrypted data, I like it because I don't want the encrypted data length got too long, but now the dart_des 1.0.0 is different, it encrypt 8 bytes data and got 16 bytes data, it's hard to send data to stm32 mcu, so could I want to know it's possible to compatible with 0.0.2 version and also get null safety feature ?
Thanks in advance .
kitty
I'm having a problem regarding to the length of the key. At the case that I'm currently working on I have to use 16 byte key, but I keep getting an exception that the key must be 8 byte long even though that I've followed the exact same snippet from the documentation
Please support padding mode PKCS5. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.