?
Solved

Large, VERY Large numbers.

Posted on 2003-03-09
10
Medium Priority
?
126 Views
Last Modified: 2010-05-01
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
Comment
Question by:ozzie_man
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 2

Expert Comment

by:Chuckie_Ice
ID: 8100900
This is simple, use a String and NOT an Integer
Example:

Dim strCombos As String

strCombos = 6 ^ 255
0
 
LVL 6

Expert Comment

by:graham_charles
ID: 8101055
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
 

Expert Comment

by:Siebe
ID: 8101647
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!

 

Expert Comment

by:Siebe
ID: 8101653
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
 
LVL 11

Expert Comment

by:rdrunner
ID: 8102253
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
 
LVL 38

Expert Comment

by:PaulHews
ID: 8103054
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
 
LVL 2

Expert Comment

by:Jacamar
ID: 8103845
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
 

Expert Comment

by:CleanupPing
ID: 8900427
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
 
LVL 49

Expert Comment

by:DanRollins
ID: 9074580
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
 

Accepted Solution

by:
YensidMod earned 0 total points
ID: 9165947
Question is PAQ'd and no points refunded.

YensidMod
Community Support Moderator @Experts Exchange
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month11 days, 22 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question