Giter VIP home page Giter VIP logo

Comments (9)

AKushWarrior avatar AKushWarrior commented on May 29, 2024

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.

s349856186 avatar s349856186 commented on May 29, 2024

@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.

AKushWarrior avatar AKushWarrior commented on May 29, 2024

@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.

s349856186 avatar s349856186 commented on May 29, 2024

@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.

s349856186 avatar s349856186 commented on May 29, 2024

@AKushWarrior
Can you help me,Thanks

from steel_crypt.

AKushWarrior avatar AKushWarrior commented on May 29, 2024

Sorry, I wasn't monitoring this issue for some reason. I'll take a look...

from steel_crypt.

AKushWarrior avatar AKushWarrior commented on May 29, 2024

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.

AKushWarrior avatar AKushWarrior commented on May 29, 2024

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.

AKushWarrior avatar AKushWarrior commented on May 29, 2024

I can't give you a concrete code example until you give me what encoding CryptoJS uses.

from steel_crypt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.