• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 127
  • Last Modified:

Large, VERY Large numbers.

I am currently working on a VB program to tell me how many possible combinations of a password there is.

What I am doing is:

Password Length ^ (to the power of) 255.

When I get above 6 ^ 255, there isn't a data-type to hold it.

How can I overcome this problem.
0
ozzie_man
Asked:
ozzie_man
1 Solution
 
Chuckie_IceCommented:
This is simple, use a String and NOT an Integer
Example:

Dim strCombos As String

strCombos = 6 ^ 255
0
 
graham_charlesCommented:
Well, strings are simple, but Chuckie_ice is assuming you don't want to perform any operations on the numbers. It sounds like your program might just be "incrementing" the total, so that might be true, and a string will do fine (although you'll need to write code to increment it). If you want more operators(addition, multiplication, etc.), you'll need a code library for really big integers. There's a good VB.NET library for arbitrarily big integers at < http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=403&lngWId=10 >; I'm not sure what's out there for VB6.

Good luck,
0
 
SiebeCommented:
Put the number you want in a TextBox so:

'Assuming it is Text1
Text1.Text = 6^255

'Use Val to 'convert' the text in the textbox to a number
strCombos = Val(Text1.Text)

You can put the textbox somewhere where the users can't see it.
Hope this helps...
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SiebeCommented:
Oops, forgot that strCombos can't hold the converted number, so you have to use Val(Text1.Text) in every calculation instead of using strCombos!!
0
 
rdrunnerCommented:
Hello!

The question here is how much acuracy do you really need?

VB Offers several Datatypes you can use for this... Lets see which ones can hold 255^6 (Your Formula is the wrong way arroung... its 255 Possible letters per digit) - Also several dont make sense for passwords ... so i would suggest to use (36*2+12)^len(password) to get a "resonable" guess ;) (A-Z,a-z,1-0,!"ยง$%&/()=?*+'_-:.;,<>)

Anyway... Back to datatypes ;)

6^255 = 2,68267985373259e+198 (=Double)
255^6 = 274941996890625 (Long)

DOUBLE     8 Bytes    
 -1.79769313486232E308 bis -4.94065645841247E-324 for negative Values,
4,94065645841247E-324 bis 1,79769313486232E308 for positive Values und 0.


Another Possibility would be Currency ,

Thats a 8-Byte Integer  / 10000 and will have the best acuracy when it comes to "digits"
0
 
PaulHewsCommented:
ozzie_man, you may also consider that users do not have access to the full 256 ascii characters, unless these passwords are being created without human interaction.  In practice, english language users will have access to ASCII 32 to 126.
0
 
JacamarCommented:
a double data type will hold (in your case) up to 16^255

However, like rdrunner said above, it will give you a rounded value after 15 or 16 digits.  
0
 
CleanupPingCommented:
ozzie_man:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
DanRollinsCommented:
ozzie_man, an EE Moderator will handle this for you.
Moderator, my recommended disposition is:

    Save as PAQ -- No Refund.

DanRollins -- EE database cleanup volunteer
0
 
YensidModCommented:
Question is PAQ'd and no points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now