def binb2hex(binarray)
      hex_tab = $hexcase ? '0123456789ABCDEF' : '0123456789abcdef'
      str = ''
      # for(var i = 0; i < binarray.length * 4; i++)
      i = 0
      while i < binarray.length * 4
        str += hex_tab[(binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF].chr +
               hex_tab[(binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF].chr
        i += 1
      end
      str
    end
def binb2hex(binarray)
      hex_tab = $hexcase ? '0123456789ABCDEF' : '0123456789abcdef'
      str = ''
      # for(var i = 0; i < binarray.length * 4; i++)
      i = 0
      while i < binarray.length * 4
        str += hex_tab[(binarray[i >> 2] >> ((3 - i % 4) * 8 + 4)) & 0xF].chr +
               hex_tab[(binarray[i >> 2] >> ((3 - i % 4) * 8)) & 0xF].chr
        i += 1
      end
      str
    end
Convert an array of big-endian words to a string
   function binb2str(bin)
 {
   var str = "";
   var mask = (1 << $chrsz) - 1;
   for(var i = 0; i < bin.length * 32; i += $chrsz)
     str += String.fromCharCode((bin[i>>5] >>> (32 - $chrsz - i%32)) & mask);
   return str;
 }

 Convert an array of big-endian words to a hex string.