Home > Software design >  Is there a function in dart which is equivalent to int(a,b) from python?
Is there a function in dart which is equivalent to int(a,b) from python?

Time:11-17

I am converting a python program to flutter app.

In python I am using Crypto module and there are these lines

 signature = hashlib.sha224(msg.encode('utf-8')).hexdigest()
 print("Signature: ",signature)
 M = int(signature, 16)

In dart also there's a package named Crypto and its giving the same value of signature. Now I want to convert this signature to M like done in the python program int(signature,16).

Is there a function in dart which is equivalent to int(a,b) from python?

CodePudding user response:

Try this

int.parse(hex, radix: 16);

Or BigInt if the integer equivalent is greater than 262 - 1

BigInt.parse(hex,radix:16)
  • Related