![]() ![]() Should be made readonly because they won't change anywhere except in the constructor.Ī little LINQ could simplify this foreach ( int feedbackPoint in feedbackPoints ) ![]() These variables private bool _register = null The SHA256Managed class implements IDisposable through inheriting HashAlgorithm so you should enclose its usage in a using block. ![]() This will avoid hidden bugs and the code looks better structured. I would like to encourage you to always use them. Public Register ( int length, int feedbackPoints ) : this ( length, feedbackPoints, new byte ), although they might be optional, can lead to hidden and therefor hard to track bugs. Here is my LFSR implementation public class Register The strange thing is in my test the period is exactly half of what expected/declared by the paper (not (2^n)-1 but 2^(n-1)). My implementation accept some parameter so can be adapted to various feedback polynomials (my refernce table)įor the testing pahse i generate as many number as the cycle will allow before a repetiton (i use a byte to my testing purpose).ĮDITED (PROBLEM SOLVED IT WAS DUE A TYPO, QUESTION REPHRASED AT THE END) I haven't found any implementation in C# of the LFSR so accordling to Wikipedia i have implment it to myself. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |