Neos.IdentityServer 3.0/Neos.IdentityServer.QrCodeNet/EncodingRegion/BCHCalculator.cs
/// <summary>
/// With input number and polynomial number. Method will calculate BCH value and return
/// </summary>
/// <param name="num">input number</param>
/// <param name="poly">Polynomial number</param>
/// <returns>BCH value</returns>
With input number and polynomial number. Method will calculate BCH value and return
With input number and polynomial number . Method will calculate BCH value and return
internal static int CalculateBCH(int num, int poly)
		{
			int polyMSB = PosMSB(poly);
			num <<= (polyMSB - 1);
			int numMSB = PosMSB(num);
			while( PosMSB(num) >= polyMSB)
			{
				num ^= poly << (numMSB - polyMSB);
				numMSB = PosMSB(num);
			}
			return num;
		}
internal static int CalculateBCH ( int num , int poly ) { int polyMSB = PosMSB ( poly ) ; num <<= ( polyMSB - 1 ) ; int numMSB = PosMSB ( num ) ; while ( PosMSB ( num ) >= polyMSB ) { num ^= poly << ( numMSB - polyMSB ) ; numMSB = PosMSB ( num ) ; } return num ; }
With input number and polynomial number.
With input number and polynomial number .
//num's length will be old length + new length - 1.  //Once divide poly number. BCH number will be one length short than Poly number's length. //left shift Poly number to same level as num. Then xor.  //Remove most significant bits of num.
None
num
int
None
poly
int
None