Skip to content

A VB.NET implementation of the Reed-Solomon algorithm, supporting error, erasure and errata correction

License

Notifications You must be signed in to change notification settings

Sonic-The-Hedgehog-LNK1123/ReedSolomon-VB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Universal Reed-Solomon Codec in VB.NET

A VB.NET implementation of the Reed-Solomon algorithm, supporting error, erasure and errata correction.

Uses code from the Reed-Solomon component of the ZXing.Net project and code I've ported to C#, from the python code at Wikiversity, I then ported the C# code to VB.NET by using the code converter at icsharpcode.net

NOTE

This code is provided for static linking into VB.NET programs only, for use in other languages, please use the C# implementation, binary releases of the C# implementation are available here.

Code examples

Create a representation of a Galois field:

Dim field As New GenericGF(285, 256, 0)

Reed-Solomon encoding:

Create an instance of the ReedSolomonEncoder class, specifying the Galois field to use:

Dim rse As New ReedSolomonEncoder(field)

To encode the string "Hello World" with 9 ecc symbols, 9 null-values must be appended to store the ecc symbols:

Dim data As Integer() = New Integer() {&H48, &H65, &H6C, &H6C, &H6F, &H20, &H57, &H6F, &H72, &H6C, &H64, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00, &H00}

Call the Encode() method of the ReedSolomonEncoder class to encode data with Reed-Solomon:

rse.Encode(data, 9)

The data variable now contains:

&H48, &H65, &H6C, &H6C, &H6F, &H20, &H57, &H6F, &H72, &H6C, &H64, &H40, &H86, &H08, &HD5, &H2C, &HAE, &HB5, &H8F, &H83

Reed-Solomon decoding:

Previous data variable with some errors:

data = New Integer() {&H00, &H02, &H02, &H02, &H02, &H02, &H57, &H6F, &H72, &H6C, &H64, &H40, &H86, &H8, &HD5, &H2C, &HAE, &HB5, &H8F, &H83}

Providing the locations of some erasures:

Dim erasures As Integer() = New Integer() {0, 1, 2}

Create an instance of the ReedSolomonDecoder class, specifying the Galois field to use:

Dim rsd As New ReedSolomonDecoder(field)

Call the Decode() method of the ReedSolomonDecoder class to decode (correct) data with Reed-Solomon:

If rsd.Decode(data, 9, erasures) Then

    ' Data corrected.

Else

    ' Too many errors/erasures to correct.

End If

The data variable now contains:

&H48, &H65, &H6C, &H6C, &H6F, &H20, &H57, &H6F, &H72, &H6C, &H64, &H40, &H86, &H08, &HD5, &H2C, &HAE, &HB5, &H8F, &H83

License

This project uses source files which are under Apache License 2.0, thus this repository is also under this license.

About

A VB.NET implementation of the Reed-Solomon algorithm, supporting error, erasure and errata correction

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published