Click here to Skip to main content
15,884,986 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
This is encoding of reed Solomon but i want to decode which is totally reverse of following code. How can i get this. Can anyone help me? Thank you in advance


VB
Module Module1
    Dim i As Integer
    Dim j As Integer
    Dim k As Integer = Console.ReadLine()
    Dim m As Integer = Console.ReadLine()
    Dim d(10) As Integer
    Dim c(20) As Integer
    Dim t As Integer = 0
    Dim a() As Integer = {228, 48, 15, 111, 62}
    Dim b As Integer
    Dim result As Integer

    Public Function Mult(ByVal t As Integer, ByVal tempa As Integer) As Integer
        Dim Log(255) As Integer
        Dim Alog(255) As Integer
        ' Dim a As Integer
        Dim b As Integer = t
        Log(0) = -255
        Alog(0) = 1
        For i As Integer = 1 To 255
            Alog(i) = Alog(i - 1) * 2
            If (Alog(i) >= 256) Then Alog(i) = Alog(i) Xor 301
            Log(Alog(i)) = i
        Next
        result = Alog((Log(tempa) + Log(b)) Mod 255)

        Return result
    End Function
    Sub Main()
        For i As Integer = 0 To m - 1
            d(i) = Console.ReadLine()

        Next i
        For i As Integer = 1 To 10
            c(i) = 0
        Next i
        For i As Integer = 0 To m - 1

            t = (d(i) Xor c(k - 1))
            For j As Integer = k - 1 To 0 Step -1
                If t = 0 Then
                    c(j) = 0
                Else
                    c(j) = Mult(t, a(j))
                End If
                If j > 0 Then c(j) = c(j - 1) Xor c(j)
            Next
        Next

        For i As Integer = 0 To k - 1
            Console.WriteLine(c(i))
        Next

    End Sub

End Module
Posted
Comments
Rage 8-Apr-14 10:59am    
"i want to decode which is totally reverse of following code".
This is unclear. What do you want to achieve exactly ?
Sergey Alexandrovich Kryukov 8-Apr-14 14:48pm    
You are right. It makes no sense at all. Reed–Solomon is the error correction algorithm and the code (data) used for correction.
I actually put is as an answer...
—SA
ajay12292 9-Apr-14 2:49am    
I mean to say in above code input is data codeword and got error codeword but i want to reverse that process. I mean input is error codeword and want data from it.
ajay12292 9-Apr-14 2:51am    
And i want to tell you that it works correctly and i cross checked it so i m sure about that. Thank you.

1 solution

Please see my comment to the question.

When you say "following code", you show the program code (implementing part of the Reed-Solomon algorithm or not :-)); there is no such concept as "reversing" it. This code is not the same as "error correcting codes", which is some data the algorithm works with. The question simply makes no sense.

Please see:
http://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction[^],
http://en.wikipedia.org/wiki/Error-correcting_code[^].

—SA
 
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