# Possibility Calculation Math, Formulas

Started by
setthesun
, Jun 17 2004 07:08 AM

6 replies to this topic

### #1

Posted 17 June 2004 - 07:08 AM

I'm looking for math formulas (yeah I was sleeping in school life ) for possibility calculation.

For example how can I calculate all possibilities about 4 characters password etc.

Is there any good resource from basics to experts. Also I'm looking for about possibility calculation algorithms , brute force algorithms, permutations etc.

Thanks;

For example how can I calculate all possibilities about 4 characters password etc.

Is there any good resource from basics to experts. Also I'm looking for about possibility calculation algorithms , brute force algorithms, permutations etc.

Thanks;

setthesun me = new setthesun();

### #2 Guest_BlaStA_*

Posted 17 June 2004 - 07:26 AM

I think for calculating the possibilities of a 4 character password you have to use this formula:

x = characters possible (from A-Z it would be 26 for example)

y = length of password (in this case 4)

The number of possibilities would be x^y. So, for a non casesensitive password with 4 chars, there were 456976 possibilities.

x = characters possible (from A-Z it would be 26 for example)

y = length of password (in this case 4)

The number of possibilities would be x^y. So, for a non casesensitive password with 4 chars, there were 456976 possibilities.

### #4

Posted 18 June 2004 - 07:15 AM

Very good reply Thanksyeah, proof of concept

let's say there's 3 different possibilities of characters & 2 letters

that would be 3^2

AA

AB

AC

BA

BB

BC

CA

CB

CC

which proves 9

ok now any algorithm to generate this ?

AA

AB

AC

BA

BB

BC

CA

CB

CC

setthesun me = new setthesun();

### #5 Guest_A2 _*

Posted 18 June 2004 - 11:23 AM

well for an algorithm to generate you're gonna be using the same basic mathematical ideas. in visual basic, it would look something like

note:

mod = modulo operator, basically returns the remainder

\ = integral division operator, returns an integer (note for non-nerds: in this crazy computer world, the word integer is almost synonymous with 'rounded down number', cause storing fractions n decimals requires special data types) (note for nerds: if i'm wasting my time, or shit like this doesn't need to be explained here please tell me :/ )

on execution this would print

Dim alphabet As String Dim strlen As Integer, _ i As Integer, _ place1 As Integer, _ place2 As Integer alphabet = "ABC" 'our alphabet strlen = 2 'we want 2 character strings For i = 0 To ((Len(alphabet) ^ strlen) - 1) place1 = (i Mod Len(alphabet)) + 1 place2 = (i \ Len(alphabet)) + 1 Debug.Print Mid(alphabet, place2, 1) & Mid(alphabet, place1, 1) Next i

note:

mod = modulo operator, basically returns the remainder

\ = integral division operator, returns an integer (note for non-nerds: in this crazy computer world, the word integer is almost synonymous with 'rounded down number', cause storing fractions n decimals requires special data types) (note for nerds: if i'm wasting my time, or shit like this doesn't need to be explained here please tell me :/ )

on execution this would print

AA AB AC BA BB BC CA CB CCto the immediate/debug window... it'd probably be more usefull to dump the output to file though

### #6

Posted 20 June 2004 - 08:28 AM

Thank you very much, great code.well for an algorithm to generate you're gonna be using the same basic mathematical ideas. in visual basic, it would look something like

Dim alphabet As String Dim strlen As Integer, _ i As Integer, _ place1 As Integer, _ place2 As Integer alphabet = "ABC" 'our alphabet strlen = 2 'we want 2 character strings For i = 0 To ((Len(alphabet) ^ strlen) - 1) place1 = (i Mod Len(alphabet)) + 1 place2 = (i \ Len(alphabet)) + 1 Debug.Print Mid(alphabet, place2, 1) & Mid(alphabet, place1, 1) Next i

note:

mod = modulo operator, basically returns the remainder

\ = integral division operator, returns an integer (note for non-nerds: in this crazy computer world, the word integer is almost synonymous with 'rounded down number', cause storing fractions n decimals requires special data types) (note for nerds: if i'm wasting my time, or shit like this doesn't need to be explained here please tell me :/ )

on execution this would printAA AB AC BA BB BC CA CB CCto the immediate/debug window... it'd probably be more usefull to dump the output to file though

setthesun me = new setthesun();

### #7

Posted 21 June 2004 - 01:05 AM

I just tried this code but it doesn't work if I change length

setthesun me = new setthesun();

#### 0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users