Comments (9)
Okay, so this is how you do this here:
import 'package:steel_crypt/steel_crypt.dart';
var hash1 = HashCrypt('SHA-256');
var hash2 = HashCrypt('MD5');
var keyAES = hash1.hash(key); //If key is the same variable from your example
print(AesCrypt(keyAES, 'cbc', 'pkcs7').encrypt(pw); //if pw is the same variable from your example
Lemme know if you have questions or issues. Closing this for now.
from steel_crypt.
@AKushWarrior
Thanks for your reply.
var pw = "1234";
var key = "123";
var hash1 = HashCrypt('SHA-256');
var hash2 = HashCrypt('MD5');
var keyAES = hash1.hash(key);
var pwd = AesCrypt(keyAES, 'cbc', 'pkcs7').encrypt(pw);
print("=log=111="+pwd);
But hash2 not used, and the code get error:
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Invalid argument(s): Initialization vector must be the same length as block size
from steel_crypt.
@s349856186 whoops. The below should work.
import 'package:steel_crypt/steel_crypt.dart';
var hash1 = HashCrypt('SHA-256');
var hash2 = HashCrypt('MD5');
var keyAES = hash1.hash(key); //If key is the same variable from your example
print(AesCrypt(keyAES, 'cbc', 'pkcs7').encrypt(pw, hash2.hash(key))); //if pw and key are the same variables from your example
from steel_crypt.
@AKushWarrior
Thanks for your reply.
I tried this method before and still got the same error, so I do n’t know how to use it.
Can you help me,Thanks
[ERROR:flutter/lib/ui/ui_dart_state.cc(157)] Unhandled Exception: Invalid argument(s): Initialization vector must be the same length as block size
from steel_crypt.
@AKushWarrior
Can you help me,Thanks
from steel_crypt.
Sorry, I wasn't monitoring this issue for some reason. I'll take a look...
from steel_crypt.
Ah. The problem is that AES uses UTF-16 codeunits, whereas HashCrypt() uses base64 encoding/decoding.
This will be fixed in steel_crypt 2.0. Tune into #22 .
from steel_crypt.
Okay, what I said was not the problem at all. You should use the new "raw" classes, and just take the first 16 digits of the hash as the iv.
from steel_crypt.
I can't give you a concrete code example until you give me what encoding CryptoJS uses.
from steel_crypt.
Related Issues (20)
- Get iv automatically HOT 6
- FormatException: Invalid character HOT 2
- Password-based AES CBC encryption? HOT 5
- SHA3 SHAKE HOT 3
- How to use AES mode ECB with ZeroPadding HOT 1
- Cannot call has pass in PBKDF2 mode HOT 4
- Investigate AES-GCM divergence, tag HOT 17
- Trying to encryption/decryption data using NodeJs Fails HOT 13
- RegistryFactoryException: No algorithm registered of type BlockCipher with name: AES/OFB HOT 7
- RegistryFactoryException when calling HashCrypt(algo: HashAlgo.Sha3_256).hash(inp: username) HOT 6
- Flutter web build fails when including any version of steel crypt. HOT 8
- 'SecureRandom' is imported from both 'package:encrypt/encrypt.dart' and 'package:pointycastle/api.dart'.
- encrypt and decrypt data between python crypto package and dart steel_crypt HOT 1
- AES-256-GCM HOT 3
- Publish package HOT 1
- Null safety HOT 5
- It's "insecure" HOT 1
- Wrong password for decryption raises FormatException (Clarification) HOT 2
- Speed
- Does this package allows AES-GCM or ChaCha20Poly1305 streaming? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from steel_crypt.