Government Security
Network Security Resources

Jump to content

Photo

Possibility Calculation Math, Formulas

- - - - - algorithm
  • Please log in to reply
6 replies to this topic

#1 setthesun

setthesun

    Sergeant First Class

  • Sergeant Major
  • 574 posts

Posted 17 June 2004 - 07:08 AM

I'm looking for math formulas (yeah I was sleeping in school life :P ) 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;

setthesun me = new setthesun();

#2 Guest_BlaStA_*

Guest_BlaStA_*
  • Guests

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.

#3 Logan

Logan

    Specialist

  • Sergeant Major
  • 1,596 posts

Posted 17 June 2004 - 07:37 AM

yeah, proof of concept :P
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


#4 setthesun

setthesun

    Sergeant First Class

  • Sergeant Major
  • 574 posts

Posted 18 June 2004 - 07:15 AM

yeah, proof of concept :P
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

Very good reply :) Thanks

ok now any algorithm to generate this ?

AA
AB
AC
BA
BB
BC
CA
CB
CC



setthesun me = new setthesun();

#5 Guest_A2 _*

Guest_A2 _*
  • Guests

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

   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
CC
to the immediate/debug window... it'd probably be more usefull to dump the output to file though :P

#6 setthesun

setthesun

    Sergeant First Class

  • Sergeant Major
  • 574 posts

Posted 20 June 2004 - 08:28 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

   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
CC
to the immediate/debug window... it'd probably be more usefull to dump the output to file though :P

Thank you very much, great code.

setthesun me = new setthesun();

#7 setthesun

setthesun

    Sergeant First Class

  • Sergeant Major
  • 574 posts

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();





Also tagged with one or more of these keywords: algorithm