If you want speed this up, you might wanna try unpack's template for counting bits.

perlpacktut#Doing-Sums

And an even parity bit can be determined like this:

my $evenparity = unpack( '%1b*', $mask );

And you could use & to isolate the right bits with pre-calculated bit-masks.

PS: not sure why you use B64 for 32bit hex.

update

that's a weak demo because I don't seem to get MSB and LSB right.

DB<85> $n=pack 'h8', '3E10F67A' DB<86> undef $m0; vec($m0,$_,1)=1 for 0, 1, 3, 4, 6, 8, 10, 11, 13, + 15, 17, 19, 21, 23, 25, 26, 28, 30 DB<87> say unpack 'b32',$_ for $n, $m0, $n & $m0 11000111100000001111011011100101 11011010101101010101010101101010 11000010100000000101010001100000 DB<88> p unpack '%1b', $n & $m0 1

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice


In reply to Re^4: ECC computation by LanX
in thread ECC computation by savangadi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.