Click here to Skip to main content
15,880,392 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi im trying to evaluate below statement in vb.net but i don't know how to do that so anyone can help
me ?

JavaScript
var code = eval("(0x4247f4e627ca7065145406ab01f7f7e3)");
alert(code);


and got the result "8.810266794149574e+37"

I want this to be done in .NET

Update:

C#
function getPoW(a, b) {
        var c = 0;
        do hash_hex = md5(md5(b + c)), hash = eval("(0x" + hash_hex + ")"), ++c; while (hash >= a);
        return c
}


Thanks in advance :)
Posted
Updated 16-Nov-13 1:29am
v3

1 solution

You are pretty much on a loser there - .NET does not easily support numbers larger than int64 - and that is an int128, which won't even fit in a decimal...

There is the BigIntger class:
VB
Dim hexString As String = "4247f4e627ca7065145406ab01f7f7e3"
Dim bi As BigInteger = BigInteger.Parse(hexString, System.Globalization.NumberStyles.HexNumber)

But whether that is useful to you depends on what you are planning on doing with the data...
 
Share this answer
 
v2
Comments
nazarinlaw 16-Nov-13 6:35am    
Thank you bro, sorry for that, i didn't know that :)
OriginalGriff 16-Nov-13 6:37am    
You're welcome!
nazarinlaw 16-Nov-13 6:38am    
Is there anyway can i convert this "8.810266794149574e+37" into "88102667941495738829884669591129946083" ?
nazarinlaw 16-Nov-13 6:45am    
Just figured it out ! thank you though :)
OriginalGriff 16-Nov-13 6:56am    
You're welcome!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900