Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I'm working on a vb.net version of the bifid cipher decoder/cracker.

I found some code that will create the 5x5 matrix out of the alphabet - the letter J.
That I converted from a C# version.

Private KeyMatrix As String(,) = New String(4, 4) {}

VB
Private Sub BuildKeyMatrix()
    Dim k As Integer = 65
    For i As Integer = 0 To 4
        For j As Integer = 0 To 4 'index has to start at zero or errors out
            If k = 74 Then
                k += 1
            End If
            ' j’yi alma(j take) (j ascii = 64)
            KeyMatrix(i, j) = Chr(k).ToString()
            k += 1
        Next
    Next
End Sub


When viewed thru the debugger you see it is showing index / value pair as

0,0 A
0,1 B
0,2 C
0,3 D
0,4 E
1,0 F
1,1 G
1,2 H
and so on

If I do this I can get the letters.

VB
For Each ltr In KeyMatrix
    strbldr.AppendLine(ltr)
Next

But how do I get the Index array back by letter value ?
A standard Index(of ) does not work for indexs of array.

I may just use two Zero based indexes or list(of type) one of Char and another of the Integer array.
Posted
Updated 5-Jul-14 8:42am
v2
Comments
Sergey Alexandrovich Kryukov 5-Jul-14 23:59pm    
Not clear. Is some index type the array? Then in what sense is it the index? Yes, this is possible, but — index in what object?
Or is it just the array of rank 2? what is "letter value"? And so on...
You don't even show the definition of KeyMatrix.
—SA
ledtech3 6-Jul-14 1:11am    
Take a closer look.
It is baisicly creating a list of Char but instead of the normal index number being 0 to x
it is (0,0) (0,1) etc..

I think an easier way to do it is to is to just create a list of Integer array and select a index value of 0 to x and out put the integer array.
I finally got that to work.

1 solution

After looking into this more the answer is to not use this method to create the matrix.
There is no built in way to get the "Points" back out without creating your own function.

The easier way is the way they done it here
http://practicalcryptography.com/ciphers/classical-era/bifid/[^]

Just view the source of the page to see the functions.

They are basicly creating two list of integer to work with the x,y locations in the 5x5 matrix.
 
Share this answer
 

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